diff --git a/applet.cpp b/applet.cpp index 1d7e557b7..de41d6133 100644 --- a/applet.cpp +++ b/applet.cpp @@ -76,7 +76,6 @@ #include #endif -#include "abstracttoolbox.h" #include "authorizationrule.h" #include "configloader.h" #include "containment.h" diff --git a/corona.cpp b/corona.cpp index f65a092ba..6da7ee624 100644 --- a/corona.cpp +++ b/corona.cpp @@ -40,7 +40,6 @@ #include #include "abstractdialogmanager.h" -#include "abstracttoolbox.h" #include "containment.h" #include "containmentactionspluginsconfig.h" #include "pluginloader.h" @@ -476,7 +475,7 @@ void CoronaPrivate::init() lockAction->setText(i18n("Lock Widgets")); lockAction->setAutoRepeat(true); lockAction->setIcon(KDE::icon("object-locked")); - lockAction->setData(AbstractToolBox::ControlTool); + lockAction->setData(Containment::ControlTool); lockAction->setShortcut(KShortcut("alt+d, l")); lockAction->setShortcutContext(Qt::ApplicationShortcut); @@ -488,7 +487,7 @@ void CoronaPrivate::init() action->setText(i18n("Shortcut Settings")); action->setIcon(KDE::icon("configure-shortcuts")); action->setAutoRepeat(false); - action->setData(AbstractToolBox::ConfigureTool); + action->setData(Containment::ConfigureTool); //action->setShortcut(KShortcut("ctrl+h")); action->setShortcutContext(Qt::ApplicationShortcut); diff --git a/private/applet_p.cpp b/private/applet_p.cpp index 9834f2c66..057ff5322 100644 --- a/private/applet_p.cpp +++ b/private/applet_p.cpp @@ -35,7 +35,6 @@ #include #include -#include "abstracttoolbox.h" #include "containment.h" #include "corona.h" #include "pluginloader.h" @@ -291,14 +290,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent) configAction->setText(i18n("Widget Settings")); configAction->setIcon(KDE::icon("configure")); configAction->setShortcut(KShortcut("alt+d, s")); - configAction->setData(AbstractToolBox::ConfigureTool); + configAction->setData(Containment::ConfigureTool); KAction *closeApplet = actions->addAction("remove"); closeApplet->setAutoRepeat(false); closeApplet->setText(i18n("Remove this Widget")); closeApplet->setIcon(KDE::icon("edit-delete")); closeApplet->setShortcut(KShortcut("alt+d, r")); - closeApplet->setData(AbstractToolBox::DestructiveTool); + closeApplet->setData(Containment::DestructiveTool); KAction *runAssociatedApplication = actions->addAction("run associated application"); runAssociatedApplication->setAutoRepeat(false); @@ -307,7 +306,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent) runAssociatedApplication->setShortcut(KShortcut("alt+d, t")); runAssociatedApplication->setVisible(false); runAssociatedApplication->setEnabled(false); - runAssociatedApplication->setData(AbstractToolBox::ControlTool); + runAssociatedApplication->setData(Containment::ControlTool); return actions; } diff --git a/private/themedwidgetinterface.cpp b/private/themedwidgetinterface.cpp deleted file mode 100644 index 9910620e6..000000000 --- a/private/themedwidgetinterface.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/****************************************************************************** -* Copyright 2011 by Aaron Seigo * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*******************************************************************************/ - -#include "themedwidgetinterface_p.h" - -#include "theme.h" - -namespace Plasma -{ - -PaletteHelper *PaletteHelper::s_paletteHelper = 0; - -PaletteHelper::PaletteHelper() - : QObject() -{ - generatePalettes(); - connect(Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(generatePalettes())); - connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(generatePalettes())); -} - -PaletteHelper *PaletteHelper::self() -{ - if (!s_paletteHelper) { - s_paletteHelper = new PaletteHelper; - } - - return s_paletteHelper; -} - -void PaletteHelper::generatePalettes() -{ - Theme *theme = Theme::defaultTheme(); - - QColor color = theme->color(Theme::TextColor); - palette = qApp->palette(); - palette.setColor(QPalette::Normal, QPalette::WindowText, color); - palette.setColor(QPalette::Inactive, QPalette::WindowText, color); - - palette.setColor(QPalette::Normal, QPalette::Link, theme->color(Theme::LinkColor)); - palette.setColor(QPalette::Normal, QPalette::LinkVisited, theme->color(Theme::VisitedLinkColor)); - - qreal alpha = color.alphaF(); - color.setAlphaF(0.6); - palette.setColor(QPalette::Disabled, QPalette::WindowText, color); - color.setAlphaF(alpha); - - palette.setColor(QPalette::Normal, QPalette::Text, color); - palette.setColor(QPalette::Inactive, QPalette::Text, color); - - const QColor buttonColor = Theme::defaultTheme()->color(Theme::ButtonTextColor); - palette.setColor(QPalette::Normal, QPalette::ButtonText, buttonColor); - palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonColor); - - //FIXME: hardcoded colors .. looks incorrect - palette.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0)); - palette.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0)); - - buttonPalette = palette; - buttonPalette.setColor(QPalette::Normal, QPalette::Text, buttonColor); - buttonPalette.setColor(QPalette::Inactive, QPalette::Text, buttonColor); - - emit palettesUpdated(); -} - - -} // namespace Plasma - -#include "moc_themedwidgetinterface_p.cpp" - diff --git a/private/themedwidgetinterface_p.h b/private/themedwidgetinterface_p.h deleted file mode 100644 index ac2eeec3b..000000000 --- a/private/themedwidgetinterface_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/****************************************************************************** -* Copyright 2009 by Aaron Seigo * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*******************************************************************************/ - -#ifndef THEMEDWIDGETINTERFACE_P_H -#define THEMEDWIDGETINTERFACE_P_H - -#include "kglobalsettings.h" -#include - -#include "theme.h" - -namespace Plasma -{ - -class PaletteHelper : public QObject -{ - Q_OBJECT -public: - static PaletteHelper *self(); - -public Q_SLOTS: - void generatePalettes(); - -Q_SIGNALS: - void palettesUpdated(); - -public: - QPalette palette; - QPalette buttonPalette; - -private: - PaletteHelper(); - static PaletteHelper *s_paletteHelper; -}; - - -template -class ThemedWidgetInterface -{ -public: - ThemedWidgetInterface(T *publicClass) - : q(publicClass), - customPalette(false), - customFont(false), - buttonColorForText(false), - internalPaletteChange(false) - { - QObject::connect(PaletteHelper::self(), SIGNAL(palettesUpdated()), q, SLOT(setPalette())); - } - - void initTheming() - { - customPalette = false; - customFont = false; - setPalette(); - } - - void setPalette() - { - if (!customPalette) { - internalPaletteChange = true; - q->setPalette((buttonColorForText ? PaletteHelper::self()->buttonPalette - : PaletteHelper::self()->palette)); - internalPaletteChange = false; - } - - if (!customFont) { - q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont)); - customFont = false; - } - } - - void changeEvent(QEvent *event) - { - switch (event->type()) { - case QEvent::FontChange: - customFont = q->font() != QApplication::font(); - break; - - case QEvent::PaletteChange: - if (!internalPaletteChange && - q->palette() != (buttonColorForText ? PaletteHelper::self()->buttonPalette : PaletteHelper::self()->palette)) { - customPalette = true; - } - break; - - default: - break; - } - } - - void setWidget(QWidget *widget) - { - internalPaletteChange = true; - q->setWidget(widget); - internalPaletteChange = false; - } - - void event(QEvent *event) - { - if (event->type() == QEvent::Show) { - customFont = q->font() != QApplication::font(); - } - } - - T *q; - bool customPalette : 1; - bool customFont : 1; - bool buttonColorForText : 1; - bool internalPaletteChange : 1; -}; - -} // namespace Plasma -#endif -