From 07294b49f2a8d74021530d755e3e6b1ef907fae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 10 Oct 2013 13:53:10 +0200 Subject: [PATCH] [kcmdeco] Use new DecorationButton types for describing the buttons Rather heavy change to get the kcm to no longer use the string based definition of the buttons on the left and right. --- kcmkwin/kwindecoration/buttons.cpp | 131 ++++++++++-------- kcmkwin/kwindecoration/buttons.h | 18 +-- .../kwindecoration/buttonsconfigdialog.cpp | 4 +- kcmkwin/kwindecoration/buttonsconfigdialog.h | 4 +- kcmkwin/kwindecoration/decorationmodel.cpp | 13 +- kcmkwin/kwindecoration/decorationmodel.h | 4 +- kcmkwin/kwindecoration/kwindecoration.cpp | 24 ++-- kcmkwin/kwindecoration/kwindecoration.h | 16 +-- kcmkwin/kwindecoration/preview.cpp | 6 +- kcmkwin/kwindecoration/preview.h | 6 +- 10 files changed, 115 insertions(+), 111 deletions(-) diff --git a/kcmkwin/kwindecoration/buttons.cpp b/kcmkwin/kwindecoration/buttons.cpp index 44879e4bf9..9d876d3bc1 100644 --- a/kcmkwin/kwindecoration/buttons.cpp +++ b/kcmkwin/kwindecoration/buttons.cpp @@ -64,7 +64,7 @@ ButtonDrag::ButtonDrag(Button btn) QDataStream stream(&data, QIODevice::WriteOnly); stream << btn.name; stream << btn.icon; - stream << btn.type.unicode(); + stream << btn.type; stream << (int) btn.duplicate; stream << (int) btn.supported; setData(BUTTONDRAGMIMETYPE, data); @@ -84,9 +84,9 @@ bool ButtonDrag::decode(QDropEvent* e, Button& btn) QDataStream stream(data); stream >> btn.name; stream >> btn.icon; - ushort type; + int type; stream >> type; - btn.type = QChar(type); + btn.type = KDecorationDefines::DecorationButton(type); int duplicate; stream >> duplicate; btn.duplicate = duplicate; @@ -103,7 +103,7 @@ Button::Button() { } -Button::Button(const QString& n, const QBitmap& i, QChar t, bool d, bool s) +Button::Button(const QString& n, const QBitmap& i, KDecorationDefines::DecorationButton t, bool d, bool s) : name(n), icon(i), type(t), @@ -696,115 +696,126 @@ ButtonPositionWidget::ButtonPositionWidget(QWidget *parent) if (style == "ButtonVertical") { m_supportedButtons = "MNSHIAX_FBLR"; // support all buttons - new ButtonSourceItem(m_buttonSource, getButton('N', dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonApplicationMenu, dummy)); } #endif - new ButtonSourceItem(m_buttonSource, getButton('R', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('L', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('B', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('F', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('X', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('A', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('I', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('H', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('S', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('M', dummy)); - new ButtonSourceItem(m_buttonSource, getButton('_', dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonResize, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonShade, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonKeepBelow, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonKeepAbove, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonClose, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMaximizeRestore, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMinimize, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonQuickHelp, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonOnAllDesktops, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMenu, dummy)); + new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonExplicitSpacer, dummy)); } ButtonPositionWidget::~ButtonPositionWidget() { } -Button ButtonPositionWidget::getButton(QChar type, bool& success) +Button ButtonPositionWidget::getButton(KDecorationDefines::DecorationButton type, bool& success) { success = true; - if (type == 'R') { + switch (type) { + case KDecorationDefines::DecorationButtonResize: { QBitmap bmp = QBitmap::fromData(QSize(resize_width, resize_height), resize_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Resize"), bmp, 'R', false, m_supportedButtons.contains('R')); - } else if (type == 'L') { + return Button(i18n("Resize"), bmp, type, false, m_supportedButtons.contains('R')); + } + case KDecorationDefines::DecorationButtonShade: { QBitmap bmp = QBitmap::fromData(QSize(shade_width, shade_height), shade_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Shade"), bmp, 'L', false, m_supportedButtons.contains('L')); - } else if (type == 'B') { + return Button(i18n("Shade"), bmp, type, false, m_supportedButtons.contains('L')); + } + case KDecorationDefines::DecorationButtonKeepBelow: { QBitmap bmp = QBitmap::fromData(QSize(keepbelowothers_width, keepbelowothers_height), keepbelowothers_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Keep Below Others"), bmp, 'B', false, m_supportedButtons.contains('B')); - } else if (type == 'F') { + return Button(i18n("Keep Below Others"), bmp, type, false, m_supportedButtons.contains('B')); + } + case KDecorationDefines::DecorationButtonKeepAbove: { QBitmap bmp = QBitmap::fromData(QSize(keepaboveothers_width, keepaboveothers_height), keepaboveothers_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Keep Above Others"), bmp, 'F', false, m_supportedButtons.contains('F')); - } else if (type == 'X') { + return Button(i18n("Keep Above Others"), bmp, type, false, m_supportedButtons.contains('F')); + } + case KDecorationDefines::DecorationButtonClose: { QBitmap bmp = QBitmap::fromData(QSize(close_width, close_height), close_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Close"), bmp, 'X', false, m_supportedButtons.contains('X')); - } else if (type == 'A') { + return Button(i18n("Close"), bmp, type, false, m_supportedButtons.contains('X')); + } + case KDecorationDefines::DecorationButtonMaximizeRestore: { QBitmap bmp = QBitmap::fromData(QSize(maximize_width, maximize_height), maximize_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Maximize"), bmp, 'A', false, m_supportedButtons.contains('A')); - } else if (type == 'I') { + return Button(i18n("Maximize"), bmp, type, false, m_supportedButtons.contains('A')); + } + case KDecorationDefines::DecorationButtonMinimize: { QBitmap bmp = QBitmap::fromData(QSize(minimize_width, minimize_height), minimize_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Minimize"), bmp, 'I', false, m_supportedButtons.contains('I')); - } else if (type == 'H') { + return Button(i18n("Minimize"), bmp, type, false, m_supportedButtons.contains('I')); + } + case KDecorationDefines::DecorationButtonQuickHelp: { QBitmap bmp = QBitmap::fromData(QSize(help_width, help_height), help_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("Help"), bmp, 'H', false, m_supportedButtons.contains('H')); - } else if (type == 'S') { + return Button(i18n("Help"), bmp, type, false, m_supportedButtons.contains('H')); + } + case KDecorationDefines::DecorationButtonOnAllDesktops: { QBitmap bmp = QBitmap::fromData(QSize(onalldesktops_width, onalldesktops_height), onalldesktops_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("On All Desktops"), bmp, 'S', false, m_supportedButtons.contains('S')); - } else if (type == 'M') { + return Button(i18n("On All Desktops"), bmp, type, false, m_supportedButtons.contains('S')); + } + case KDecorationDefines::DecorationButtonMenu: { QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18nc("Button showing window actions menu", "Window Menu"), bmp, 'M', false, m_supportedButtons.contains('M')); + return Button(i18nc("Button showing window actions menu", "Window Menu"), bmp, type, false, m_supportedButtons.contains('M')); #ifdef KWIN_BUILD_KAPPMENU - } else if (type == 'N') { + } + case KDecorationDefines::DecorationButtonApplicationMenu: { QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18nc("Button showing application menu imported from dbusmenu", "Application Menu"), bmp, 'N', false, m_supportedButtons.contains('N')); + return Button(i18nc("Button showing application menu imported from dbusmenu", "Application Menu"), bmp, type, false, m_supportedButtons.contains('N')); #endif - } else if (type == '_') { + } + case KDecorationDefines::DecorationButtonExplicitSpacer: { QBitmap bmp = QBitmap::fromData(QSize(spacer_width, spacer_height), spacer_bits); bmp.createMaskFromColor(Qt::white); - return Button(i18n("--- spacer ---"), bmp, '_', true, m_supportedButtons.contains('_')); - } else { + return Button(i18n("--- spacer ---"), bmp, type, true, m_supportedButtons.contains('_')); + } + default: success = false; return Button(); } } -QString ButtonPositionWidget::buttonsLeft() const +QList ButtonPositionWidget::buttonsLeft() const { - ButtonList btns = m_dropSite->buttonsLeft; - QString btnString = ""; - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - btnString.append((*it)->button().type); + QList ret; + for (auto button : m_dropSite->buttonsLeft) { + ret << button->button().type; } - return btnString; + return ret; } -QString ButtonPositionWidget::buttonsRight() const +QList ButtonPositionWidget::buttonsRight() const { - ButtonList btns = m_dropSite->buttonsRight; - QString btnString = ""; - for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) { - btnString.append((*it)->button().type); + QList ret; + for (auto button : m_dropSite->buttonsRight) { + ret << button->button().type; } - return btnString; + return ret; } -void ButtonPositionWidget::setButtonsLeft(const QString &buttons) +void ButtonPositionWidget::setButtonsLeft(const QList &buttons) { // to keep the button lists consistent, first remove all left buttons, then add buttons again... m_dropSite->clearLeft(); - for (int i = 0; i < buttons.length(); ++i) { + for (auto button : buttons) { bool succ = false; - Button btn = getButton(buttons[i], succ); + Button btn = getButton(button, succ); if (succ) { m_dropSite->buttonsLeft.append(new ButtonDropSiteItem(btn)); m_buttonSource->hideButton(btn.type); @@ -814,14 +825,14 @@ void ButtonPositionWidget::setButtonsLeft(const QString &buttons) m_dropSite->update(); } -void ButtonPositionWidget::setButtonsRight(const QString &buttons) +void ButtonPositionWidget::setButtonsRight(const QList &buttons) { // to keep the button lists consistent, first remove all left buttons, then add buttons again... m_dropSite->clearRight(); - for (int i = 0; i < buttons.length(); ++i) { + for (auto button : buttons) { bool succ = false; - Button btn = getButton(buttons[i], succ); + Button btn = getButton(button, succ); if (succ) { m_dropSite->buttonsRight.append(new ButtonDropSiteItem(btn)); m_buttonSource->hideButton(btn.type); diff --git a/kcmkwin/kwindecoration/buttons.h b/kcmkwin/kwindecoration/buttons.h index a66684f4b8..965b6cb42a 100644 --- a/kcmkwin/kwindecoration/buttons.h +++ b/kcmkwin/kwindecoration/buttons.h @@ -32,12 +32,12 @@ #ifndef BUTTONS_H #define BUTTONS_H +#include + #include #include #include -class KDecorationFactory; - namespace KWin { @@ -48,12 +48,12 @@ class Button { public: Button(); - Button(const QString& name, const QBitmap& icon, QChar type, bool duplicate, bool supported); + Button(const QString& name, const QBitmap& icon, KDecorationDefines::DecorationButton type, bool duplicate, bool supported); virtual ~Button(); QString name; QBitmap icon; - QChar type; + KDecorationDefines::DecorationButton type; bool duplicate; bool supported; }; @@ -199,17 +199,17 @@ public: explicit ButtonPositionWidget(QWidget *parent = 0); ~ButtonPositionWidget(); - QString buttonsLeft() const; - QString buttonsRight() const; - void setButtonsLeft(const QString &buttons); - void setButtonsRight(const QString &buttons); + QList buttonsLeft() const; + QList buttonsRight() const; + void setButtonsLeft(const QList &buttons); + void setButtonsRight(const QList &buttons); Q_SIGNALS: void changed(); private: void clearButtonList(const ButtonList& btns); - Button getButton(QChar type, bool& success); + Button getButton(KDecorationDefines::DecorationButton type, bool& success); ButtonDropSite* m_dropSite; ButtonSource *m_buttonSource; diff --git a/kcmkwin/kwindecoration/buttonsconfigdialog.cpp b/kcmkwin/kwindecoration/buttonsconfigdialog.cpp index 5c629a8c34..8745dabeb7 100644 --- a/kcmkwin/kwindecoration/buttonsconfigdialog.cpp +++ b/kcmkwin/kwindecoration/buttonsconfigdialog.cpp @@ -74,12 +74,12 @@ bool KWinDecorationButtonsConfigDialog::showTooltips() const return m_ui->showToolTipsCheckBox->isChecked(); } -QString KWinDecorationButtonsConfigDialog::buttonsLeft() const +QList KWinDecorationButtonsConfigDialog::buttonsLeft() const { return m_ui->buttonPositionWidget->buttonsLeft(); } -QString KWinDecorationButtonsConfigDialog::buttonsRight() const +QList KWinDecorationButtonsConfigDialog::buttonsRight() const { return m_ui->buttonPositionWidget->buttonsRight(); } diff --git a/kcmkwin/kwindecoration/buttonsconfigdialog.h b/kcmkwin/kwindecoration/buttonsconfigdialog.h index cb6fa7586c..f5740a03a5 100644 --- a/kcmkwin/kwindecoration/buttonsconfigdialog.h +++ b/kcmkwin/kwindecoration/buttonsconfigdialog.h @@ -47,8 +47,8 @@ public: bool customPositions() const; bool showTooltips() const; - QString buttonsLeft() const; - QString buttonsRight() const; + QList buttonsLeft() const; + QList buttonsRight() const; private Q_SLOTS: void changed(); diff --git a/kcmkwin/kwindecoration/decorationmodel.cpp b/kcmkwin/kwindecoration/decorationmodel.cpp index 663bac1ae9..f9bb6adb12 100644 --- a/kcmkwin/kwindecoration/decorationmodel.cpp +++ b/kcmkwin/kwindecoration/decorationmodel.cpp @@ -56,8 +56,6 @@ DecorationModel::DecorationModel(KSharedConfigPtr config, QObject* parent) , m_plugins(new KDecorationPreviewPlugins(config)) , m_preview(new KDecorationPreview()) , m_customButtons(false) - , m_leftButtons(QString()) - , m_rightButtons(QString()) , m_options(new KDecorationPreviewOptions) { QHash roleNames; @@ -313,19 +311,14 @@ bool DecorationModel::setData(const QModelIndex& index, const QVariant& value, i void DecorationModel::changeButtons(const KWin::DecorationButtons *buttons) { m_customButtons = buttons->customPositions(); - m_leftButtons = buttons->leftButtons(); - m_rightButtons = buttons->rightButtons(); m_options->setCustomTitleButtonsEnabled(m_customButtons); - m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons); + m_options->setCustomTitleButtons(buttons->leftButtons(), buttons->rightButtons()); } -void DecorationModel::setButtons(bool custom, const QString& left, const QString& right) +void DecorationModel::setButtons(bool custom, const QList &left, const QList &right) { m_customButtons = custom; - m_leftButtons = left; - m_rightButtons = right; - m_options->setCustomTitleButtonsEnabled(m_customButtons); - m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons); + m_options->setCustomTitleButtons(left, right); } QModelIndex DecorationModel::indexOfLibrary(const QString& libraryName) const diff --git a/kcmkwin/kwindecoration/decorationmodel.h b/kcmkwin/kwindecoration/decorationmodel.h index 356873303c..58da01acc7 100644 --- a/kcmkwin/kwindecoration/decorationmodel.h +++ b/kcmkwin/kwindecoration/decorationmodel.h @@ -105,7 +105,7 @@ public: /** * Changes the button state without regenerating the preview. */ - void setButtons(bool custom, const QString& left, const QString& right); + void setButtons(bool custom, const QList& left, const QList& right); void setBorderSize(const QModelIndex& index, KDecorationDefines::BorderSize size); @@ -127,8 +127,6 @@ private: KDecorationPlugins* m_plugins; KDecorationPreview* m_preview; bool m_customButtons; - QString m_leftButtons; - QString m_rightButtons; KSharedConfigPtr m_config; QScopedPointer m_options; }; diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index 2c8def82fa..682ed4d120 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -216,9 +216,11 @@ void KWinDecorationModule::readConfig(const KConfigGroup & conf) // ============ m_decorationButtons->setCustomPositions(conf.readEntry("CustomButtonPositions", false)); // Menu and onAllDesktops buttons are default on LHS - m_decorationButtons->setLeftButtons(conf.readEntry("ButtonsOnLeft", KDecorationOptions::defaultTitleButtonsLeft())); + m_decorationButtons->setLeftButtons(KDecorationOptions::readDecorationButtons(conf, "ButtonsOnLeft", + KDecorationOptions::defaultTitleButtonsLeft())); // Help, Minimize, Maximize and Close are default on RHS - m_decorationButtons->setRightButtons(conf.readEntry("ButtonsOnRight", KDecorationOptions::defaultTitleButtonsRight())); + m_decorationButtons->setRightButtons(KDecorationOptions::readDecorationButtons(conf, "ButtonsOnRight", + KDecorationOptions::defaultTitleButtonsRight())); if (m_configLoaded) m_model->changeButtons(m_decorationButtons); else { @@ -242,8 +244,8 @@ void KWinDecorationModule::writeConfig(KConfigGroup & conf) conf.writeEntry("ShowToolTips", m_showTooltips); // Button settings - conf.writeEntry("ButtonsOnLeft", m_decorationButtons->leftButtons()); - conf.writeEntry("ButtonsOnRight", m_decorationButtons->rightButtons()); + KDecorationOptions::writeDecorationButtons(conf, "ButtonsOnLeft", m_decorationButtons->leftButtons()); + KDecorationOptions::writeDecorationButtons(conf, "ButtonsOnRight", m_decorationButtons->rightButtons()); conf.writeEntry("BorderSize", static_cast(m_model->data(index, DecorationModel::BorderSizeRole).toInt())); @@ -508,9 +510,11 @@ void KWinDecorationModule::updateViewPosition(int v) DecorationButtons::DecorationButtons(QObject *parent) : QObject(parent) , m_customPositions(false) - , m_leftButtons(KDecorationOptions::defaultTitleButtonsLeft()) - , m_rightButtons(KDecorationOptions::defaultTitleButtonsRight()) + , m_leftButtons() + , m_rightButtons() { + setLeftButtons(KDecorationOptions::defaultTitleButtonsLeft()); + setRightButtons(KDecorationOptions::defaultTitleButtonsRight()); } DecorationButtons::~DecorationButtons() @@ -522,12 +526,12 @@ bool DecorationButtons::customPositions() const return m_customPositions; } -const QString &DecorationButtons::leftButtons() const +const QList &DecorationButtons::leftButtons() const { return m_leftButtons; } -const QString &DecorationButtons::rightButtons() const +const QList &DecorationButtons::rightButtons() const { return m_rightButtons; } @@ -541,7 +545,7 @@ void DecorationButtons::setCustomPositions(bool set) emit customPositionsChanged(); } -void DecorationButtons::setLeftButtons(const QString &leftButtons) +void DecorationButtons::setLeftButtons(const QList &leftButtons) { if (m_leftButtons == leftButtons) { return; @@ -550,7 +554,7 @@ void DecorationButtons::setLeftButtons(const QString &leftButtons) emit leftButtonsChanged(); } -void DecorationButtons::setRightButtons (const QString &rightButtons) +void DecorationButtons::setRightButtons(const QList &rightButtons) { if (m_rightButtons == rightButtons) { return; diff --git a/kcmkwin/kwindecoration/kwindecoration.h b/kcmkwin/kwindecoration/kwindecoration.h index 81419dcabd..fb70ba0891 100644 --- a/kcmkwin/kwindecoration/kwindecoration.h +++ b/kcmkwin/kwindecoration/kwindecoration.h @@ -53,23 +53,21 @@ public: explicit KWinDecorationForm(QWidget* parent); }; -class DecorationButtons : public QObject +class DecorationButtons : public QObject, public KDecorationDefines { Q_OBJECT Q_PROPERTY(bool customButtonPositions READ customPositions WRITE setCustomPositions NOTIFY customPositionsChanged) - Q_PROPERTY(QString leftButtons READ leftButtons WRITE setLeftButtons NOTIFY leftButtonsChanged) - Q_PROPERTY(QString rightButtons READ rightButtons WRITE setRightButtons NOTIFY rightButtonsChanged) public: explicit DecorationButtons(QObject *parent = 0); virtual ~DecorationButtons(); bool customPositions() const; - const QString &leftButtons() const; - const QString &rightButtons() const; + const QList &leftButtons() const; + const QList &rightButtons() const; void setCustomPositions(bool set); - void setLeftButtons(const QString &leftButtons); - void setRightButtons(const QString &rightButtons); + void setLeftButtons(const QList &buttons); + void setRightButtons(const QList &buttons); public Q_SLOTS: void resetToDefaults(); @@ -81,8 +79,8 @@ Q_SIGNALS: private: bool m_customPositions; - QString m_leftButtons; - QString m_rightButtons; + QList m_leftButtons; + QList m_rightButtons; }; class KWinDecorationModule : public KCModule, public KDecorationDefines diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index 4562a09df9..379c698842 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -577,9 +577,9 @@ void KDecorationPreviewOptions::updateSettings() if (customButtonsChanged) setCustomButtonPositions(customButtons); if (customButtons) { - if (!customTitleButtonsLeft.isNull()) + if (!customTitleButtonsLeft.isEmpty()) setTitleButtonsLeft(customTitleButtonsLeft); - if (!customTitleButtonsRight.isNull()) + if (!customTitleButtonsRight.isEmpty()) setTitleButtonsRight(customTitleButtonsRight); } else { setTitleButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft()); @@ -602,7 +602,7 @@ void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled) updateSettings(); } -void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right) +void KDecorationPreviewOptions::setCustomTitleButtons(const QList &left, const QList &right) { customTitleButtonsLeft = left; customTitleButtonsRight = right; diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index a396e8d8a6..aa2851ac22 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -182,14 +182,14 @@ public: void setCustomBorderSize(BorderSize size); void setCustomTitleButtonsEnabled(bool enabled); - void setCustomTitleButtons(const QString &left, const QString &right); + void setCustomTitleButtons(const QList &left, const QList &right); private: BorderSize customBorderSize; bool customButtonsChanged; bool customButtons; - QString customTitleButtonsLeft; - QString customTitleButtonsRight; + QList customTitleButtonsLeft; + QList customTitleButtonsRight; }; class KDecorationPreviewPlugins