remove last dependencies of abstracttoolbox

This commit is contained in:
Marco Martin 2012-09-25 20:21:37 +02:00
parent 743c0f44a8
commit f58711521e
5 changed files with 5 additions and 224 deletions

View File

@ -76,7 +76,6 @@
#include <solid/powermanagement.h>
#endif
#include "abstracttoolbox.h"
#include "authorizationrule.h"
#include "configloader.h"
#include "containment.h"

View File

@ -40,7 +40,6 @@
#include <kwindowsystem.h>
#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);

View File

@ -35,7 +35,6 @@
#include <kkeysequencewidget.h>
#include <kstandarddirs.h>
#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;
}

View File

@ -1,85 +0,0 @@
/******************************************************************************
* Copyright 2011 by Aaron Seigo <aseigo@kde.org> *
* *
* 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"

View File

@ -1,131 +0,0 @@
/******************************************************************************
* Copyright 2009 by Aaron Seigo <aseigo@kde.org> *
* *
* 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 <QApplication>
#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 T>
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