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:
parent
9f4246059e
commit
e5230a3f3e
106
containment.cpp
106
containment.cpp
@ -178,13 +178,13 @@ void Containment::init()
|
||||
activityAction->setShortcut(QKeySequence("ctrl+shift+a"));
|
||||
d->actions().addAction("addSiblingContainment", activityAction);
|
||||
|
||||
d->toolBox->addTool(this->action("add widgets"));
|
||||
d->toolBox->addTool(this->action("zoom in"));
|
||||
d->toolBox->addTool(this->action("zoom out"));
|
||||
d->toolbox->addTool(this->action("add widgets"));
|
||||
d->toolbox->addTool(this->action("zoom in"));
|
||||
d->toolbox->addTool(this->action("zoom out"));
|
||||
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();
|
||||
@ -292,18 +292,18 @@ void Containment::setContainmentType(Containment::Type type)
|
||||
d->type = type;
|
||||
|
||||
if (isContainment() && type == DesktopContainment) {
|
||||
if (!d->toolBox) {
|
||||
d->createToolBox();
|
||||
if (!d->toolbox) {
|
||||
d->createToolbox();
|
||||
}
|
||||
} else if (isContainment() && type == PanelContainment) {
|
||||
if (!d->toolBox) {
|
||||
d->createToolBox();
|
||||
d->toolBox->setSize(22);
|
||||
d->toolBox->setIconSize(QSize(16, 16));
|
||||
if (!d->toolbox) {
|
||||
d->createToolbox();
|
||||
d->toolbox->setSize(22);
|
||||
d->toolbox->setIconSize(QSize(16, 16));
|
||||
}
|
||||
} else {
|
||||
delete d->toolBox;
|
||||
d->toolBox = 0;
|
||||
delete d->toolbox;
|
||||
d->toolbox = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -569,9 +569,9 @@ void Containment::setScreen(int screen)
|
||||
#ifndef Q_OS_WIN
|
||||
// we want to listen to changes in work area if our screen changes
|
||||
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) {
|
||||
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox()));
|
||||
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolbox()));
|
||||
}
|
||||
#endif
|
||||
if (screen > -1 && corona()) {
|
||||
@ -828,38 +828,38 @@ void Containment::enableAction(const QString &name, bool enable)
|
||||
|
||||
void Containment::addToolboxTool(QAction *action)
|
||||
{
|
||||
if (d->toolBox) {
|
||||
d->toolBox->addTool(action);
|
||||
if (d->toolbox) {
|
||||
d->toolbox->addTool(action);
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::removeToolboxTool(QAction *action)
|
||||
{
|
||||
if (d->toolBox) {
|
||||
d->toolBox->removeTool(action);
|
||||
if (d->toolbox) {
|
||||
d->toolbox->removeTool(action);
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::setToolBoxOpen(bool open)
|
||||
void Containment::setToolboxOpen(bool open)
|
||||
{
|
||||
if (open) {
|
||||
openToolBox();
|
||||
openToolbox();
|
||||
} else {
|
||||
closeToolBox();
|
||||
closeToolbox();
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::openToolBox()
|
||||
void Containment::openToolbox()
|
||||
{
|
||||
if (d->toolBox) {
|
||||
d->toolBox->showToolbox();
|
||||
if (d->toolbox) {
|
||||
d->toolbox->showToolbox();
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::closeToolBox()
|
||||
void Containment::closeToolbox()
|
||||
{
|
||||
if (d->toolBox) {
|
||||
d->toolBox->hideToolbox();
|
||||
if (d->toolbox) {
|
||||
d->toolbox->hideToolbox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -995,45 +995,45 @@ void Containment::Private::zoomOut()
|
||||
emit q->zoomRequested(q, Plasma::ZoomOut);
|
||||
}
|
||||
|
||||
Toolbox* Containment::Private::createToolBox()
|
||||
Toolbox* Containment::Private::createToolbox()
|
||||
{
|
||||
if (!toolBox) {
|
||||
if (!toolbox) {
|
||||
switch (type) {
|
||||
case PanelContainment:
|
||||
toolBox = new PanelToolbox(q);
|
||||
connect(toolBox, SIGNAL(toggled()), q, SIGNAL(toolBoxToggled()));
|
||||
toolbox = new PanelToolbox(q);
|
||||
connect(toolbox, SIGNAL(toggled()), q, SIGNAL(toolboxToggled()));
|
||||
break;
|
||||
//defaults to DesktopContainment right now
|
||||
default:
|
||||
toolBox = new DesktopToolbox(q);
|
||||
connect(toolBox, SIGNAL(toggled()), toolBox, SLOT(toggle()));
|
||||
toolbox = new DesktopToolbox(q);
|
||||
connect(toolbox, SIGNAL(toggled()), toolbox, SLOT(toggle()));
|
||||
break;
|
||||
}
|
||||
positionToolBox();
|
||||
positionToolbox();
|
||||
|
||||
}
|
||||
|
||||
return toolBox;
|
||||
return toolbox;
|
||||
}
|
||||
|
||||
void Containment::Private::positionToolBox()
|
||||
void Containment::Private::positionToolbox()
|
||||
{
|
||||
if (!toolBox) {
|
||||
if (!toolbox) {
|
||||
return;
|
||||
}
|
||||
|
||||
//The placement assumes that the geometry width/height is no more than the screen
|
||||
if (type == PanelContainment) {
|
||||
if (q->formFactor() == Vertical) {
|
||||
toolBox->setOrientation(Qt::Vertical);
|
||||
toolBox->setPos(q->geometry().width()/2 - toolBox->boundingRect().width()/2, q->geometry().height());
|
||||
toolbox->setOrientation(Qt::Vertical);
|
||||
toolbox->setPos(q->geometry().width()/2 - toolbox->boundingRect().width()/2, q->geometry().height());
|
||||
//defaulting to Horizontal right now
|
||||
} else {
|
||||
toolBox->setOrientation(Qt::Horizontal);
|
||||
toolbox->setOrientation(Qt::Horizontal);
|
||||
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 {
|
||||
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 {
|
||||
@ -1041,9 +1041,9 @@ void Containment::Private::positionToolBox()
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
r = desktop->availableGeometry(screen);
|
||||
if (q->view() && !q->view()->transform().isScaling()) {
|
||||
toolBox->setPos(r.topRight());
|
||||
toolbox->setPos(r.topRight());
|
||||
} 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;
|
||||
}
|
||||
|
||||
//kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolBox;
|
||||
//kDebug() << "got containmentConstraintsEvent" << constraints << (QObject*)toolbox;
|
||||
if (constraints & Plasma::ImmutableConstraint) {
|
||||
//update actions
|
||||
bool unlocked = q->immutability() == Mutable;
|
||||
@ -1094,25 +1094,25 @@ void Containment::Private::containmentConstraintsEvent(Plasma::Constraints const
|
||||
|
||||
if (q->isContainment() && type == PanelContainment) {
|
||||
if (unlocked) {
|
||||
toolBox->show();
|
||||
toolbox->show();
|
||||
} else {
|
||||
toolBox->hide();
|
||||
toolbox->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((constraints & Plasma::SizeConstraint || constraints & Plasma::ScreenConstraint) &&
|
||||
toolBox) {
|
||||
positionToolBox();
|
||||
toolbox) {
|
||||
positionToolbox();
|
||||
}
|
||||
|
||||
if (constraints & Plasma::FormFactorConstraint) {
|
||||
if (toolBox) {
|
||||
if (toolbox) {
|
||||
if (q->formFactor() == Vertical) {
|
||||
toolBox->setOrientation(Qt::Vertical);
|
||||
toolbox->setOrientation(Qt::Vertical);
|
||||
//defaults to horizontal
|
||||
} else {
|
||||
toolBox->setOrientation(Qt::Horizontal);
|
||||
toolbox->setOrientation(Qt::Horizontal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,19 +240,19 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void openToolBox();
|
||||
void openToolbox();
|
||||
|
||||
/**
|
||||
* Closes Containment's toolbox
|
||||
*/
|
||||
void closeToolBox();
|
||||
void closeToolbox();
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void toolBoxToggled();
|
||||
void toolboxToggled();
|
||||
|
||||
/**
|
||||
* 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 triggerShowAddWidgets())
|
||||
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 zoomOut())
|
||||
Q_PRIVATE_SLOT(d, void toggleDesktopImmutability())
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
location(Floating),
|
||||
focusedApplet(0),
|
||||
screen(-1), // no screen
|
||||
toolBox(0),
|
||||
toolbox(0),
|
||||
type(Containment::NoContainmentType),
|
||||
positioning(false)
|
||||
{
|
||||
@ -51,8 +51,8 @@ public:
|
||||
applets.clear();
|
||||
}
|
||||
|
||||
Toolbox* createToolBox();
|
||||
void positionToolBox();
|
||||
Toolbox* createToolbox();
|
||||
void positionToolbox();
|
||||
void triggerShowAddWidgets();
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ public:
|
||||
Applet *focusedApplet;
|
||||
QMap<Applet*, AppletHandle*> handles;
|
||||
int screen;
|
||||
Toolbox *toolBox;
|
||||
Toolbox *toolbox;
|
||||
Containment::Type type;
|
||||
bool positioning;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user