Merge remote branch 'origin/KDE/4.7' into frameworks

Conflicts:
	plasma/corona.cpp
	plasma/packagemetadata.cpp
	plasma/private/packages.cpp
	plasma/theme.cpp
This commit is contained in:
Aaron Seigo 2011-12-20 11:57:49 +01:00
commit 8b09ffb51f
11 changed files with 157 additions and 105 deletions

View File

@ -432,8 +432,6 @@ install(FILES
install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
install(FILES data/kconfig_updates/plasma_popupapplet_fix_groups.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(PROGRAMS data/kconfig_updates/plasma_popupapplet_fix_groups.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)

View File

@ -112,7 +112,7 @@ void Corona::saveLayout(const QString &configName) const
if (configName.isEmpty() || configName == d->configName) { if (configName.isEmpty() || configName == d->configName) {
c = config(); c = config();
} else { } else {
c = KSharedConfig::openConfig(configName); c = KSharedConfig::openConfig(configName, KConfig::SimpleConfig);
} }
d->saveLayout(c); d->saveLayout(c);
@ -329,7 +329,7 @@ void Corona::clearContainments()
KSharedConfigPtr Corona::config() const KSharedConfigPtr Corona::config() const
{ {
if (!d->config) { if (!d->config) {
d->config = KSharedConfig::openConfig(d->configName); d->config = KSharedConfig::openConfig(d->configName, KConfig::SimpleConfig);
} }
return d->config; return d->config;
@ -595,6 +595,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig
} }
pos.rx() = qMax(0, pos.x()); pos.rx() = qMax(0, pos.x());
pos.ry() = qMax(0, pos.y());
return pos; return pos;
} }

View File

@ -1,9 +0,0 @@
#!/usr/bin/perl
while(<>) {
if ($_ =~ m/^\[.*\[Configuration\]\[PopupApplet\]$/) {
print "# DELETEGROUP $_";
$_ =~ s/\[Configuration\]\[PopupApplet\]$/[PopupApplet]/;
}
print $_;
}

View File

@ -1,12 +0,0 @@
# Fix groups of the form ...[Configuration][PopupApplet] into ...[PopupApplet]
Id=PlasmaPopupAppletFixGroups1
File=plasma-appletsrc
Script=plasma_popupapplet_fix_groups.pl,perl
#
Id=PlasmaPopupAppletFixGroups2
File=plasmarc
Script=plasma_popupapplet_fix_groups.pl,perl
#
Id=PlasmaPopupAppletFixGroups3
File=plasmoidviewer-appletsrc
Script=plasma_popupapplet_fix_groups.pl,perl

View File

@ -472,8 +472,27 @@ void Dialog::mouseMoveEvent(QMouseEvent *event)
break; break;
} }
if ((newWidth >= minimumSize().width()) && (newHeight >= minimumSize().height())) { QRect newGeom(position, QSize(newWidth, newHeight));
setGeometry(QRect(position, QSize(newWidth, newHeight)));
// now sanity check the resize results again min constraints, if any
if (d->leftResizeMin > -1 && newGeom.left() > d->leftResizeMin) {
newGeom.setLeft(d->leftResizeMin);
}
if (d->topResizeMin > -1 && newGeom.top() > d->topResizeMin) {
newGeom.setTop(d->topResizeMin);
}
if (d->rightResizeMin > -1 && newGeom.right() < d->rightResizeMin) {
newGeom.setRight(d->rightResizeMin);
}
if (d->bottomResizeMin > -1 && newGeom.bottom() < d->bottomResizeMin) {
newGeom.setBottom(d->bottomResizeMin);
}
if ((newGeom.width() >= minimumSize().width()) && (newGeom.height() >= minimumSize().height())) {
setGeometry(newGeom);
} }
} }
@ -500,9 +519,9 @@ void Dialog::mousePressEvent(QMouseEvent *event)
void Dialog::mouseReleaseEvent(QMouseEvent *event) void Dialog::mouseReleaseEvent(QMouseEvent *event)
{ {
if (d->resizeStartCorner != Dialog::NoCorner) { if (d->resizeStartCorner != Dialog::NoCorner) {
emit dialogResized();
d->resizeStartCorner = Dialog::NoCorner; d->resizeStartCorner = Dialog::NoCorner;
unsetCursor(); unsetCursor();
emit dialogResized();
} }
QWidget::mouseReleaseEvent(event); QWidget::mouseReleaseEvent(event);
@ -726,6 +745,38 @@ Dialog::ResizeCorners Dialog::resizeCorners() const
return d->resizeCorners; return d->resizeCorners;
} }
bool Dialog::isUserResizing() const
{
return d->resizeStartCorner > NoCorner;
}
void Dialog::setMinimumResizeLimits(int left, int top, int right, int bottom)
{
d->leftResizeMin = left;
d->topResizeMin = top;
d->rightResizeMin = right;
d->bottomResizeMin = bottom;
}
void Dialog::getMinimumResizeLimits(int *left, int *top, int *right, int *bottom)
{
if (left) {
*left = d->leftResizeMin;
}
if (top) {
*top = d->topResizeMin;
}
if (right) {
*right = d->rightResizeMin;
}
if (bottom) {
*bottom = d->bottomResizeMin;
}
}
void Dialog::animatedHide(Plasma::Direction direction) void Dialog::animatedHide(Plasma::Direction direction)
{ {
if (!isVisible()) { if (!isVisible()) {

View File

@ -97,6 +97,31 @@ class PLASMA_EXPORT Dialog : public QWidget
*/ */
ResizeCorners resizeCorners() const; ResizeCorners resizeCorners() const;
/**
* @return true if currently being resized by the user
*/
bool isUserResizing() const;
/**
* Sets the minimum values that each of four sides of the rect may expand to or from
*
* @param left the screen coordinate that the left may not go beyond; -1 for no limit
* @param top the screen coordinate that the top may not go beyond; -1 for no limit
* @param right the screen coordinate that the right may not go beyond; -1 for no limit
* @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit
*/
void setMinimumResizeLimits(int left, int top, int right, int bottom);
/**
* Retrives the minimum resize limits for the dialog
*
* @param left the screen coordinate that the left may not go beyond; -1 for no limit
* @param top the screen coordinate that the top may not go beyond; -1 for no limit
* @param right the screen coordinate that the right may not go beyond; -1 for no limit
* @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit
*/
void getMinimumResizeLimits(int *left, int *top, int *right, int *bottom);
/** /**
* Causes an animated hide; requires compositing to work, otherwise * Causes an animated hide; requires compositing to work, otherwise
* the dialog will simply hide. * the dialog will simply hide.

View File

@ -523,6 +523,9 @@ void PopupApplet::timerEvent(QTimerEvent *event)
d->autohideTimer->stop(); d->autohideTimer->stop();
} }
} }
} else if (event->timerId() == d->showDialogTimer.timerId()) {
d->showDialogTimer.stop();
d->showDialog();
} else { } else {
Applet::timerEvent(event); Applet::timerEvent(event);
} }
@ -530,6 +533,7 @@ void PopupApplet::timerEvent(QTimerEvent *event)
void PopupApplet::hidePopup() void PopupApplet::hidePopup()
{ {
d->showDialogTimer.stop();
d->delayedShowTimer.stop(); d->delayedShowTimer.stop();
Dialog *dialog = d->dialogPtr.data(); Dialog *dialog = d->dialogPtr.data();
@ -669,24 +673,34 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
} }
ToolTipManager::self()->hide(q); ToolTipManager::self()->hide(q);
updateDialogPosition(); showDialogTimer.start(0, q);
}
}
KWindowSystem::setOnAllDesktops(dialog->winId(), true); void PopupAppletPrivate::showDialog()
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); {
Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) {
return;
}
if (icon) { updateDialogPosition();
dialog->setAspectRatioMode(savedAspectRatio);
}
if (q->location() != Floating) { KWindowSystem::setOnAllDesktops(dialog->winId(), true);
dialog->animatedShow(locationToDirection(q->location())); KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
} else {
dialog->show();
}
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) { if (icon) {
KWindowSystem::activateWindow(dialog->winId()); dialog->setAspectRatioMode(savedAspectRatio);
} }
if (q->location() != Floating) {
dialog->animatedShow(locationToDirection(q->location()));
} else {
dialog->show();
}
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) {
KWindowSystem::activateWindow(dialog->winId());
} }
} }
@ -720,7 +734,7 @@ void PopupAppletPrivate::dialogSizeChanged()
sizeGroup.writeEntry("DialogHeight", dialog->height()); sizeGroup.writeEntry("DialogHeight", dialog->height());
sizeGroup.writeEntry("DialogWidth", dialog->width()); sizeGroup.writeEntry("DialogWidth", dialog->width());
updateDialogPosition(); updateDialogPosition(!dialog->isUserResizing());
emit q->configNeedsSaving(); emit q->configNeedsSaving();
emit q->appletTransformedByUser(); emit q->appletTransformedByUser();
@ -810,7 +824,7 @@ void PopupAppletPrivate::restoreDialogSize()
} }
} }
void PopupAppletPrivate::updateDialogPosition() void PopupAppletPrivate::updateDialogPosition(bool move)
{ {
Plasma::Dialog *dialog = dialogPtr.data(); Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) { if (!dialog) {
@ -827,85 +841,57 @@ void PopupAppletPrivate::updateDialogPosition()
return; return;
} }
QSize s = dialog->size(); const QPoint appletPos = view->mapToGlobal(view->mapFromScene(q->scenePos()));
QPoint pos = view->mapFromScene(q->scenePos());
QPoint dialogPos;
if (!q->containment() || view == q->containment()->view()) { if (!q->containment() || view == q->containment()->view()) {
pos = corona->popupPosition(q, s, popupAlignment); kDebug() << "requesting with" << q->scenePos();
dialogPos = corona->popupPosition(q, dialog->size(), popupAlignment);
} else { } else {
pos = corona->popupPosition(q->parentItem(), s, popupAlignment); kDebug() << "requesting with" << q->parentItem();
dialogPos = corona->popupPosition(q->parentItem(), dialog->size(), popupAlignment);
} }
kDebug() << "dialog position is" << dialogPos <<" with location" << q->location() << "<<<<<<<<<<<<<<<<<<<<<<<<";
bool reverse = false; bool reverse = false;
if (q->formFactor() == Plasma::Vertical) { if (q->formFactor() == Plasma::Vertical) {
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog->size().width()/2) { reverse = (appletPos.y() + (q->size().height() / 2)) < (dialogPos.y() + (dialog->size().height() / 2));
reverse = true; dialog->setMinimumResizeLimits(-1, appletPos.y(), -1, appletPos.y() + q->size().height());
}
} else { } else {
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog->size().width()/2) { reverse = (appletPos.x() + (q->size().width() / 2)) < (dialogPos.x() + (dialog->size().width() / 2));
reverse = true; dialog->setMinimumResizeLimits(appletPos.x(), -1, appletPos.x() + q->size().width(), -1);
}
} }
Dialog::ResizeCorners resizeCorners = Dialog::NoCorner;
switch (q->location()) { switch (q->location()) {
case BottomEdge: case BottomEdge:
if (pos.x() >= q->pos().x()) { resizeCorners = Dialog::NorthEast | Dialog::NorthWest;
dialog->setResizeHandleCorners(Dialog::NorthEast); popupPlacement = reverse ? TopPosedLeftAlignedPopup : TopPosedRightAlignedPopup;
} else {
dialog->setResizeHandleCorners(Dialog::NorthWest);
}
if (reverse) {
popupPlacement = Plasma::TopPosedLeftAlignedPopup;
} else {
popupPlacement = Plasma::TopPosedRightAlignedPopup;
}
break; break;
case TopEdge: case TopEdge:
if (pos.x() >= q->pos().x()) { resizeCorners = Dialog::SouthEast | Dialog::SouthWest;
dialog->setResizeHandleCorners(Dialog::SouthEast); popupPlacement = reverse ? Plasma::BottomPosedLeftAlignedPopup : Plasma::BottomPosedRightAlignedPopup;
} else {
dialog->setResizeHandleCorners(Dialog::SouthWest);
}
if (reverse) {
popupPlacement = Plasma::BottomPosedLeftAlignedPopup;
} else {
popupPlacement = Plasma::BottomPosedRightAlignedPopup;
}
break; break;
case LeftEdge: case LeftEdge:
if (pos.y() >= q->pos().y()) { resizeCorners = Dialog::SouthEast | Dialog::NorthEast;
dialog->setResizeHandleCorners(Dialog::SouthEast); popupPlacement = reverse ? RightPosedTopAlignedPopup : RightPosedBottomAlignedPopup;
} else {
dialog->setResizeHandleCorners(Dialog::NorthEast);
}
if (reverse) {
popupPlacement = Plasma::RightPosedTopAlignedPopup;
} else {
popupPlacement = Plasma::RightPosedBottomAlignedPopup;
}
break; break;
case RightEdge: case RightEdge:
if (pos.y() >= q->pos().y()) { resizeCorners = Dialog::SouthWest | Dialog::NorthWest;
dialog->setResizeHandleCorners(Dialog::SouthWest); popupPlacement = reverse ? LeftPosedTopAlignedPopup : LeftPosedBottomAlignedPopup;
} else {
dialog->setResizeHandleCorners(Dialog::NorthWest);
}
if (reverse) {
popupPlacement = Plasma::LeftPosedTopAlignedPopup;
} else {
popupPlacement = Plasma::LeftPosedBottomAlignedPopup;
}
break; break;
default: default:
dialog->setResizeHandleCorners(Dialog::NorthEast); popupPlacement = FloatingPopup;
resizeCorners = Dialog::All;
break;
} }
dialog->move(pos); dialog->setResizeHandleCorners(resizeCorners);
if (move) {
dialog->move(dialogPos);
}
} }
} // Plasma namespace } // Plasma namespace

View File

@ -40,6 +40,10 @@ public:
view(0), view(0),
resizeCorners(Dialog::NoCorner), resizeCorners(Dialog::NoCorner),
resizeStartCorner(Dialog::NoCorner), resizeStartCorner(Dialog::NoCorner),
leftResizeMin(-1),
topResizeMin(-1),
rightResizeMin(-1),
bottomResizeMin(-1),
moveTimer(0), moveTimer(0),
aspectRatioMode(Plasma::IgnoreAspectRatio), aspectRatioMode(Plasma::IgnoreAspectRatio),
resizeChecksWithBorderCheck(false) resizeChecksWithBorderCheck(false)
@ -72,6 +76,10 @@ public:
Dialog::ResizeCorners resizeCorners; Dialog::ResizeCorners resizeCorners;
QMap<Dialog::ResizeCorner, QRect> resizeAreas; QMap<Dialog::ResizeCorner, QRect> resizeAreas;
int resizeStartCorner; int resizeStartCorner;
int leftResizeMin;
int topResizeMin;
int rightResizeMin;
int bottomResizeMin;
QTimer *moveTimer; QTimer *moveTimer;
QTimer *adjustViewTimer; QTimer *adjustViewTimer;
QTimer *adjustSizeTimer; QTimer *adjustSizeTimer;

View File

@ -39,12 +39,13 @@ public:
void iconSizeChanged(int group); void iconSizeChanged(int group);
void internalTogglePopup(bool fromActivatedSignal = false); void internalTogglePopup(bool fromActivatedSignal = false);
void showDialog();
void hideTimedPopup(); void hideTimedPopup();
void clearPopupLostFocus(); void clearPopupLostFocus();
void dialogSizeChanged(); void dialogSizeChanged();
void dialogStatusChanged(bool status); void dialogStatusChanged(bool status);
void restoreDialogSize(); void restoreDialogSize();
void updateDialogPosition(); void updateDialogPosition(bool move = true);
void popupConstraintsEvent(Plasma::Constraints constraints); void popupConstraintsEvent(Plasma::Constraints constraints);
void checkExtenderAppearance(Plasma::FormFactor f); void checkExtenderAppearance(Plasma::FormFactor f);
KConfigGroup popupConfigGroup(); KConfigGroup popupConfigGroup();
@ -64,6 +65,7 @@ public:
Plasma::AspectRatioMode savedAspectRatio; Plasma::AspectRatioMode savedAspectRatio;
QTimer *autohideTimer; QTimer *autohideTimer;
QBasicTimer delayedShowTimer; QBasicTimer delayedShowTimer;
QBasicTimer showDialogTimer;
QPoint clicked; QPoint clicked;
ItemStatus preShowStatus; ItemStatus preShowStatus;
bool popupLostFocus : 1; bool popupLostFocus : 1;

View File

@ -166,7 +166,10 @@ public:
static const char *defaultTheme; static const char *defaultTheme;
static const char *systemColorsTheme; static const char *systemColorsTheme;
static const char *themeRcFile; static const char *themeRcFile;
static PackageStructure::Ptr packageStructure;
#ifdef Q_WS_X11
static EffectWatcher *s_blurEffectWatcher; static EffectWatcher *s_blurEffectWatcher;
#endif
Theme *q; Theme *q;
QString themeName; QString themeName;
@ -209,7 +212,9 @@ const char *ThemePrivate::themeRcFile = "plasmarc";
// the system colors theme is used to cache unthemed svgs with colorization needs // the system colors theme is used to cache unthemed svgs with colorization needs
// these svgs do not follow the theme's colors, but rather the system colors // these svgs do not follow the theme's colors, but rather the system colors
const char *ThemePrivate::systemColorsTheme = "internal-system-colors"; const char *ThemePrivate::systemColorsTheme = "internal-system-colors";
#ifdef Q_WS_X11
EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0; EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0;
#endif
bool ThemePrivate::useCache() bool ThemePrivate::useCache()
{ {

View File

@ -134,22 +134,19 @@ void slideWindow(QWidget *widget, Plasma::Location location)
Display *dpy = QX11Info::display(); Display *dpy = QX11Info::display();
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False ); Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
QVarLengthArray<long, 2> data(2); QVarLengthArray<long, 2> data(2);
data[0] = -1;
switch (location) { switch (location) {
case LeftEdge: case LeftEdge:
data[0] = widget->geometry().left();
data[1] = 0; data[1] = 0;
break; break;
case TopEdge: case TopEdge:
data[0] = widget->geometry().top();
data[1] = 1; data[1] = 1;
break; break;
case RightEdge: case RightEdge:
data[0] = widget->geometry().right();
data[1] = 2; data[1] = 2;
break; break;
case BottomEdge: case BottomEdge:
data[0] = widget->geometry().bottom();
data[1] = 3; data[1] = 3;
default: default:
break; break;