use ContainmentPrivate::isPanelContainment() for more readable code
svn path=/trunk/KDE/kdelibs/; revision=1114542
This commit is contained in:
parent
b4b822e1dd
commit
548ca104e2
@ -271,8 +271,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
|
|||||||
//adjust applet actions
|
//adjust applet actions
|
||||||
KAction *appAction = qobject_cast<KAction*>(actions->action("remove"));
|
KAction *appAction = qobject_cast<KAction*>(actions->action("remove"));
|
||||||
appAction->setShortcut(KShortcut("alt+d, alt+r"));
|
appAction->setShortcut(KShortcut("alt+d, alt+r"));
|
||||||
if (c && (c->d->type == Containment::PanelContainment ||
|
if (c && c->d->isPanelContainment()) {
|
||||||
c->d->type == Containment::CustomPanelContainment)) {
|
|
||||||
appAction->setText(i18n("Remove this panel"));
|
appAction->setText(i18n("Remove this panel"));
|
||||||
} else {
|
} else {
|
||||||
appAction->setText(i18n("Remove this activity"));
|
appAction->setText(i18n("Remove this activity"));
|
||||||
@ -1595,16 +1594,10 @@ void Containment::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||||||
{
|
{
|
||||||
Applet::resizeEvent(event);
|
Applet::resizeEvent(event);
|
||||||
|
|
||||||
switch (d->type) {
|
if (d->isPanelContainment()) {
|
||||||
case Containment::PanelContainment:
|
d->positionPanel();
|
||||||
case Containment::CustomPanelContainment:
|
} else if (corona()) {
|
||||||
d->positionPanel();
|
QMetaObject::invokeMethod(corona(), "layoutContainments");
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (corona()) {
|
|
||||||
QMetaObject::invokeMethod(corona(), "layoutContainments");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->wallpaper) {
|
if (d->wallpaper) {
|
||||||
@ -2083,10 +2076,7 @@ void Containment::destroy(bool confirm)
|
|||||||
void ContainmentPrivate::createToolBox()
|
void ContainmentPrivate::createToolBox()
|
||||||
{
|
{
|
||||||
if (!toolBox) {
|
if (!toolBox) {
|
||||||
switch (type) {
|
if (isPanelContainment()) {
|
||||||
case Containment::PanelContainment:
|
|
||||||
case Containment::CustomPanelContainment:
|
|
||||||
{
|
|
||||||
PanelToolBox *pt = new PanelToolBox(q);
|
PanelToolBox *pt = new PanelToolBox(q);
|
||||||
toolBox = pt;
|
toolBox = pt;
|
||||||
pt->setSize(KIconLoader::SizeSmallMedium);
|
pt->setSize(KIconLoader::SizeSmallMedium);
|
||||||
@ -2094,16 +2084,11 @@ void ContainmentPrivate::createToolBox()
|
|||||||
if (q->immutability() != Mutable) {
|
if (q->immutability() != Mutable) {
|
||||||
pt->hide();
|
pt->hide();
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
DesktopToolBox *dt = new DesktopToolBox(q);
|
DesktopToolBox *dt = new DesktopToolBox(q);
|
||||||
toolBox = dt;
|
toolBox = dt;
|
||||||
dt->setSize(KIconLoader::SizeSmallMedium);
|
dt->setSize(KIconLoader::SizeSmallMedium);
|
||||||
dt->setIconSize(QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall));
|
dt->setIconSize(QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall));
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolBox) {
|
if (toolBox) {
|
||||||
@ -2176,7 +2161,7 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolBox) {
|
if (toolBox) {
|
||||||
if (type == Containment::PanelContainment || type == Containment::CustomPanelContainment) {
|
if (isPanelContainment()) {
|
||||||
toolBox.data()->setVisible(unlocked);
|
toolBox.data()->setVisible(unlocked);
|
||||||
} else {
|
} else {
|
||||||
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
InternalToolBox *internalToolBox = qobject_cast<InternalToolBox *>(toolBox.data());
|
||||||
@ -2382,8 +2367,7 @@ QPointF ContainmentPrivate::preferredPanelPos(Corona *corona) const
|
|||||||
// likely be too slow.
|
// likely be too slow.
|
||||||
foreach (const Containment *other, corona->containments()) {
|
foreach (const Containment *other, corona->containments()) {
|
||||||
if (other == q ||
|
if (other == q ||
|
||||||
(other->d->type != Containment::PanelContainment &&
|
!other->d->isPanelContainment() ||
|
||||||
other->d->type != Containment::CustomPanelContainment) ||
|
|
||||||
horiz != (other->formFactor() == Plasma::Horizontal)) {
|
horiz != (other->formFactor() == Plasma::Horizontal)) {
|
||||||
// only line up with panels of the same orientation
|
// only line up with panels of the same orientation
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user