stop calling it ToolBox - it's Toolbox, and the capitalization inconsistency is driving me nuts :)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=811934
This commit is contained in:
Chani Armitage 2008-05-24 06:34:08 +00:00
parent 9f4246059e
commit e5230a3f3e
3 changed files with 63 additions and 63 deletions

View File

@ -178,13 +178,13 @@ void Containment::init()
activityAction->setShortcut(QKeySequence("ctrl+shift+a")); activityAction->setShortcut(QKeySequence("ctrl+shift+a"));
d->actions().addAction("addSiblingContainment", activityAction); d->actions().addAction("addSiblingContainment", activityAction);
d->toolBox->addTool(this->action("add widgets")); d->toolbox->addTool(this->action("add widgets"));
d->toolBox->addTool(this->action("zoom in")); d->toolbox->addTool(this->action("zoom in"));
d->toolBox->addTool(this->action("zoom out")); d->toolbox->addTool(this->action("zoom out"));
if (immutability() != SystemImmutable) { if (immutability() != SystemImmutable) {
d->toolBox->addTool(this->action("lock widgets")); d->toolbox->addTool(this->action("lock widgets"));
} }
d->toolBox->addTool(this->action("addSiblingContainment")); d->toolbox->addTool(this->action("addSiblingContainment"));
} }
Applet::init(); Applet::init();
@ -292,18 +292,18 @@ void Containment::setContainmentType(Containment::Type type)
d->type = type; d->type = type;
if (isContainment() && type == DesktopContainment) { if (isContainment() && type == DesktopContainment) {
if (!d->toolBox) { if (!d->toolbox) {
d->createToolBox(); d->createToolbox();
} }
} else if (isContainment() && type == PanelContainment) { } else if (isContainment() && type == PanelContainment) {
if (!d->toolBox) { if (!d->toolbox) {
d->createToolBox(); d->createToolbox();
d->toolBox->setSize(22); d->toolbox->setSize(22);
d->toolBox->setIconSize(QSize(16, 16)); d->toolbox->setIconSize(QSize(16, 16));
} }
} else { } else {
delete d->toolBox; delete d->toolbox;
d->toolBox = 0; d->toolbox = 0;
} }
} }
@ -569,9 +569,9 @@ void Containment::setScreen(int screen)
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
// we want to listen to changes in work area if our screen changes // we want to listen to changes in work area if our screen changes
if (d->screen < 0 && screen > -1) { if (d->screen < 0 && screen > -1) {
connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox())); connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolbox()));
} else if (screen < 0) { } else if (screen < 0) {
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox())); disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolbox()));
} }
#endif #endif
if (screen > -1 && corona()) { if (screen > -1 && corona()) {
@ -828,38 +828,38 @@ void Containment::enableAction(const QString &name, bool enable)
void Containment::addToolboxTool(QAction *action) void Containment::addToolboxTool(QAction *action)
{ {
if (d->toolBox) { if (d->toolbox) {
d->toolBox->addTool(action); d->toolbox->addTool(action);
} }
} }
void Containment::removeToolboxTool(QAction *action) void Containment::removeToolboxTool(QAction *action)
{ {
if (d->toolBox) { if (d->toolbox) {
d->toolBox->removeTool(action); d->toolbox->removeTool(action);
} }
} }
void Containment::setToolBoxOpen(bool open) void Containment::setToolboxOpen(bool open)
{ {
if (open) { if (open) {
openToolBox(); openToolbox();
} else { } else {
closeToolBox(); closeToolbox();
} }
} }
void Containment::openToolBox() void Containment::openToolbox()
{ {
if (d->toolBox) { if (d->toolbox) {
d->toolBox->showToolbox(); d->toolbox->showToolbox();
} }
} }
void Containment::closeToolBox() void Containment::closeToolbox()
{ {
if (d->toolBox) { if (d->toolbox) {
d->toolBox->hideToolbox(); d->toolbox->hideToolbox();
} }
} }
@ -995,45 +995,45 @@ void Containment::Private::zoomOut()
emit q->zoomRequested(q, Plasma::ZoomOut); emit q->zoomRequested(q, Plasma::ZoomOut);
} }
Toolbox* Containment::Private::createToolBox() Toolbox* Containment::Private::createToolbox()
{ {
if (!toolBox) { if (!toolbox) {
switch (type) { switch (type) {
case PanelContainment: case PanelContainment:
toolBox = new PanelToolbox(q); toolbox = new PanelToolbox(q);
connect(toolBox, SIGNAL(toggled()), q, SIGNAL(toolBoxToggled())); connect(toolbox, SIGNAL(toggled()), q, SIGNAL(toolboxToggled()));
break; break;
//defaults to DesktopContainment right now //defaults to DesktopContainment right now
default: default:
toolBox = new DesktopToolbox(q); toolbox = new DesktopToolbox(q);
connect(toolBox, SIGNAL(toggled()), toolBox, SLOT(toggle())); connect(toolbox, SIGNAL(toggled()), toolbox, SLOT(toggle()));
break; break;
} }
positionToolBox(); positionToolbox();
} }
return toolBox; return toolbox;
} }
void Containment::Private::positionToolBox() void Containment::Private::positionToolbox()
{ {
if (!toolBox) { if (!toolbox) {
return; return;
} }
//The placement assumes that the geometry width/height is no more than the screen //The placement assumes that the geometry width/height is no more than the screen
if (type == PanelContainment) { if (type == PanelContainment) {
if (q->formFactor() == Vertical) { if (q->formFactor() == Vertical) {
toolBox->setOrientation(Qt::Vertical); toolbox->setOrientation(Qt::Vertical);
toolBox->setPos(q->geometry().width()/2 - toolBox->boundingRect().width()/2, q->geometry().height()); toolbox->setPos(q->geometry().width()/2 - toolbox->boundingRect().width()/2, q->geometry().height());
//defaulting to Horizontal right now //defaulting to Horizontal right now
} else { } else {
toolBox->setOrientation(Qt::Horizontal); toolbox->setOrientation(Qt::Horizontal);
if (QApplication::layoutDirection() == Qt::RightToLeft) { if (QApplication::layoutDirection() == Qt::RightToLeft) {
toolBox->setPos(q->geometry().left(), q->geometry().height()/2 - toolBox->boundingRect().height()/2); toolbox->setPos(q->geometry().left(), q->geometry().height()/2 - toolbox->boundingRect().height()/2);
} else { } else {
toolBox->setPos(q->geometry().width(), q->geometry().height()/2 - toolBox->boundingRect().height()/2); toolbox->setPos(q->geometry().width(), q->geometry().height()/2 - toolbox->boundingRect().height()/2);
} }
} }
} else { } else {
@ -1041,9 +1041,9 @@ void Containment::Private::positionToolBox()
QDesktopWidget *desktop = QApplication::desktop(); QDesktopWidget *desktop = QApplication::desktop();
r = desktop->availableGeometry(screen); r = desktop->availableGeometry(screen);
if (q->view() && !q->view()->transform().isScaling()) { if (q->view() && !q->view()->transform().isScaling()) {
toolBox->setPos(r.topRight()); toolbox->setPos(r.topRight());
} else { } else {
toolBox->setPos(q->mapFromScene(QPointF(q->geometry().topRight()))); toolbox->setPos(q->mapFromScene(QPointF(q->geometry().topRight())));
} }
} }
@ -1066,7 +1066,7 @@ void Containment::Private::containmentConstraintsEvent(Plasma::Constraints const
return; return;
} }
//kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolBox; //kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolbox;
if (constraints & Plasma::ImmutableConstraint) { if (constraints & Plasma::ImmutableConstraint) {
//update actions //update actions
bool unlocked = q->immutability() == Mutable; bool unlocked = q->immutability() == Mutable;
@ -1094,25 +1094,25 @@ void Containment::Private::containmentConstraintsEvent(Plasma::Constraints const
if (q->isContainment() && type == PanelContainment) { if (q->isContainment() && type == PanelContainment) {
if (unlocked) { if (unlocked) {
toolBox->show(); toolbox->show();
} else { } else {
toolBox->hide(); toolbox->hide();
} }
} }
} }
if ((constraints & Plasma::SizeConstraint || constraints & Plasma::ScreenConstraint) && if ((constraints & Plasma::SizeConstraint || constraints & Plasma::ScreenConstraint) &&
toolBox) { toolbox) {
positionToolBox(); positionToolbox();
} }
if (constraints & Plasma::FormFactorConstraint) { if (constraints & Plasma::FormFactorConstraint) {
if (toolBox) { if (toolbox) {
if (q->formFactor() == Vertical) { if (q->formFactor() == Vertical) {
toolBox->setOrientation(Qt::Vertical); toolbox->setOrientation(Qt::Vertical);
//defaults to horizontal //defaults to horizontal
} else { } else {
toolBox->setOrientation(Qt::Horizontal); toolbox->setOrientation(Qt::Horizontal);
} }
} }

View File

@ -240,19 +240,19 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Sets the open or closed state of the Containment's toolbox * Sets the open or closed state of the Containment's toolbox
* *
* @arg open true to open the ToolBox, false to close it * @arg open true to open the Toolbox, false to close it
*/ */
void setToolBoxOpen(bool open); void setToolboxOpen(bool open);
/** /**
* Open the Containment's toolbox * Open the Containment's toolbox
*/ */
void openToolBox(); void openToolbox();
/** /**
* Closes Containment's toolbox * Closes Containment's toolbox
*/ */
void closeToolBox(); void closeToolbox();
/** /**
* associate actions with this widget, including ones added after this call. * associate actions with this widget, including ones added after this call.
@ -285,7 +285,7 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Emitted when the user clicks on the toolbox * Emitted when the user clicks on the toolbox
*/ */
void toolBoxToggled(); void toolboxToggled();
/** /**
* Emitted when the containment wants a new containment to be created. * Emitted when the containment wants a new containment to be created.
@ -398,7 +398,7 @@ class PLASMA_EXPORT Containment : public Applet
Q_PRIVATE_SLOT(d, void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)) Q_PRIVATE_SLOT(d, void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets()) Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle)) Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
Q_PRIVATE_SLOT(d, void positionToolBox()) Q_PRIVATE_SLOT(d, void positionToolbox())
Q_PRIVATE_SLOT(d, void zoomIn()) Q_PRIVATE_SLOT(d, void zoomIn())
Q_PRIVATE_SLOT(d, void zoomOut()) Q_PRIVATE_SLOT(d, void zoomOut())
Q_PRIVATE_SLOT(d, void toggleDesktopImmutability()) Q_PRIVATE_SLOT(d, void toggleDesktopImmutability())

View File

@ -39,7 +39,7 @@ public:
location(Floating), location(Floating),
focusedApplet(0), focusedApplet(0),
screen(-1), // no screen screen(-1), // no screen
toolBox(0), toolbox(0),
type(Containment::NoContainmentType), type(Containment::NoContainmentType),
positioning(false) positioning(false)
{ {
@ -51,8 +51,8 @@ public:
applets.clear(); applets.clear();
} }
Toolbox* createToolBox(); Toolbox* createToolbox();
void positionToolBox(); void positionToolbox();
void triggerShowAddWidgets(); void triggerShowAddWidgets();
/** /**
@ -97,7 +97,7 @@ public:
Applet *focusedApplet; Applet *focusedApplet;
QMap<Applet*, AppletHandle*> handles; QMap<Applet*, AppletHandle*> handles;
int screen; int screen;
Toolbox *toolBox; Toolbox *toolbox;
Containment::Type type; Containment::Type type;
bool positioning; bool positioning;
}; };