From dd5f04d6aa70bd58d1fd8135517d7e40596bb212 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Fri, 9 Dec 2011 08:13:22 -0500 Subject: [PATCH 1/9] fix build on Windows, which apparently does not have the EffectWatcher --- theme.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/theme.cpp b/theme.cpp index 342731576..2b1d47a01 100644 --- a/theme.cpp +++ b/theme.cpp @@ -167,8 +167,10 @@ public: static const char *systemColorsTheme; static const char *themeRcFile; static PackageStructure::Ptr packageStructure; +#ifdef Q_WS_X11 static EffectWatcher *s_blurEffectWatcher; - +#endif + Theme *q; QString themeName; QList fallbackThemes; @@ -212,7 +214,9 @@ const char *ThemePrivate::themeRcFile = "plasmarc"; // 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 const char *ThemePrivate::systemColorsTheme = "internal-system-colors"; +#ifdef Q_WS_X11 EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0; +#endif bool ThemePrivate::useCache() { From 9c12c79b1ac3cf38b3f77c8c7ae446f01a1d50ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 10 Dec 2011 22:37:23 +0100 Subject: [PATCH 2/9] Fix incorrect offset passing to sliding popups effect For the generic case without an explicit specified offset, the offset calculation was incorrect. Instead of calculating the offset we let kwin decide and indicate it by an offset of -1. REVIEW: 103366 --- windoweffects.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/windoweffects.cpp b/windoweffects.cpp index ce411760c..3fa57d6d4 100644 --- a/windoweffects.cpp +++ b/windoweffects.cpp @@ -134,22 +134,19 @@ void slideWindow(QWidget *widget, Plasma::Location location) Display *dpy = QX11Info::display(); Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False ); QVarLengthArray data(2); + data[0] = -1; switch (location) { case LeftEdge: - data[0] = widget->geometry().left(); data[1] = 0; break; case TopEdge: - data[0] = widget->geometry().top(); data[1] = 1; break; case RightEdge: - data[0] = widget->geometry().right(); data[1] = 2; break; case BottomEdge: - data[0] = widget->geometry().bottom(); data[1] = 3; default: break; From cf8128ca17a1cf21b81cf70164399cb4ddda4580 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Mon, 12 Dec 2011 09:19:23 +0100 Subject: [PATCH 3/9] these update scripts operate on files that are no longer used --- CMakeLists.txt | 2 -- .../kconfig_updates/plasma_popupapplet_fix_groups.pl | 9 --------- .../plasma_popupapplet_fix_groups.upd | 12 ------------ 3 files changed, 23 deletions(-) delete mode 100755 data/kconfig_updates/plasma_popupapplet_fix_groups.pl delete mode 100644 data/kconfig_updates/plasma_popupapplet_fix_groups.upd diff --git a/CMakeLists.txt b/CMakeLists.txt index e4cad89e5..e48a2cdf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,8 +451,6 @@ install(FILES 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/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services) diff --git a/data/kconfig_updates/plasma_popupapplet_fix_groups.pl b/data/kconfig_updates/plasma_popupapplet_fix_groups.pl deleted file mode 100755 index 4a9f0f913..000000000 --- a/data/kconfig_updates/plasma_popupapplet_fix_groups.pl +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/perl - -while(<>) { - if ($_ =~ m/^\[.*\[Configuration\]\[PopupApplet\]$/) { - print "# DELETEGROUP $_"; - $_ =~ s/\[Configuration\]\[PopupApplet\]$/[PopupApplet]/; - } - print $_; -} diff --git a/data/kconfig_updates/plasma_popupapplet_fix_groups.upd b/data/kconfig_updates/plasma_popupapplet_fix_groups.upd deleted file mode 100644 index 677288b4f..000000000 --- a/data/kconfig_updates/plasma_popupapplet_fix_groups.upd +++ /dev/null @@ -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 From 7491b9e71f2ab986e5da64cf71a6867d6a3aa3a9 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Mon, 12 Dec 2011 09:22:19 +0100 Subject: [PATCH 4/9] appletsrc files are SimpleConfigs cascading, let alone kdeglobals, make no sense whatsoever for them. so just skip that overhead. --- corona.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corona.cpp b/corona.cpp index 055af4e00..f9cb07d01 100644 --- a/corona.cpp +++ b/corona.cpp @@ -113,7 +113,7 @@ void Corona::saveLayout(const QString &configName) const if (configName.isEmpty() || configName == d->configName) { c = config(); } else { - c = KSharedConfig::openConfig(configName); + c = KSharedConfig::openConfig(configName, KConfig::SimpleConfig); } d->saveLayout(c); @@ -337,7 +337,7 @@ void Corona::clearContainments() KSharedConfigPtr Corona::config() const { if (!d->config) { - d->config = KSharedConfig::openConfig(d->configName); + d->config = KSharedConfig::openConfig(d->configName, KConfig::SimpleConfig); } return d->config; From 645439c2998eec264c9eafc67da88ea25d8c3de3 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Mon, 22 Aug 2011 01:53:57 +0200 Subject: [PATCH 5/9] Bugfix: Plasma::PackageMetadata::read: Match the behavior of KService. Also delete the duplicate entries in PackageMetadata::write. REVIEW: 102404 Approved by Aaron J. Seigo. --- packagemetadata.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packagemetadata.cpp b/packagemetadata.cpp index 59163b21b..c9ff44644 100644 --- a/packagemetadata.cpp +++ b/packagemetadata.cpp @@ -94,7 +94,9 @@ void PackageMetadata::write(const QString &filename) const config.writeEntry("Icon", d->icon); config.writeEntry("Comment", d->description); config.writeEntry("Keywords", d->keywords); + config.deleteEntry("X-KDE-Keywords"); config.writeEntry("X-KDE-ServiceTypes", d->serviceType); + config.deleteEntry("ServiceTypes"); config.writeEntry("X-KDE-PluginInfo-Name", d->pluginName); config.writeEntry("X-KDE-PluginInfo-Author", d->author); config.writeEntry("X-KDE-PluginInfo-Email", d->email); @@ -120,8 +122,27 @@ void PackageMetadata::read(const QString &filename) d->name = config.readEntry("Name", d->name); d->icon = config.readEntry("Icon", d->icon); d->description = config.readEntry("Comment", d->description); - d->keywords = config.readEntry("Keywords", d->keywords); - d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType); + bool hasKeywords = config.hasKey("Keywords"); + bool hasXKdeKeywords = config.hasKey("X-KDE-Keywords"); + if (hasKeywords && hasXKdeKeywords) { + d->keywords = config.readEntry("Keywords", d->keywords); + d->keywords.append(config.readEntry("X-KDE-Keywords", d->keywords)); + } else if (hasKeywords) { + d->keywords = config.readEntry("Keywords", d->keywords); + } else if (hasXKdeKeywords) { + d->keywords = config.readEntry("X-KDE-Keywords", d->keywords); + } + bool hasServiceTypes = config.hasKey("ServiceTypes"); + bool hasXKdeServiceTypes = config.hasKey("X-KDE-ServiceTypes"); + if (hasServiceTypes && hasXKdeServiceTypes) { + d->serviceType = config.readEntry("ServiceTypes", d->serviceType); + d->serviceType.append(','); + d->serviceType.append(config.readEntry("X-KDE-ServiceTypes", d->serviceType)); + } else if (hasServiceTypes) { + d->serviceType = config.readEntry("ServiceTypes", d->serviceType); + } else if (hasXKdeServiceTypes) { + d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType); + } d->pluginName = config.readEntry("X-KDE-PluginInfo-Name", d->pluginName); d->author = config.readEntry("X-KDE-PluginInfo-Author", d->author); d->email = config.readEntry("X-KDE-PluginInfo-Email", d->email); From 1b2d92c08529013ae8ff7580dac515989a4be72c Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 16 Dec 2011 12:50:08 +0100 Subject: [PATCH 6/9] delay showing popups until the next processing of events allows things like hidden panels to show before calculating where to show the popup BUG:288999 --- popupapplet.cpp | 42 +++++++++++++++++++++++++++-------------- private/packages.cpp | 1 + private/popupapplet_p.h | 2 ++ 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index 07ea3f108..bb407ca12 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -600,6 +600,9 @@ void PopupApplet::timerEvent(QTimerEvent *event) d->autohideTimer->stop(); } } + } else if (event->timerId() == d->showDialogTimer.timerId()) { + d->showDialogTimer.stop(); + d->showDialog(); } else { Applet::timerEvent(event); } @@ -607,6 +610,7 @@ void PopupApplet::timerEvent(QTimerEvent *event) void PopupApplet::hidePopup() { + d->showDialogTimer.stop(); d->delayedShowTimer.stop(); Dialog *dialog = d->dialogPtr.data(); @@ -748,24 +752,34 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal) } ToolTipManager::self()->hide(q); - updateDialogPosition(); + showDialogTimer.start(0, q); + } +} - KWindowSystem::setOnAllDesktops(dialog->winId(), true); - KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); +void PopupAppletPrivate::showDialog() +{ + Plasma::Dialog *dialog = dialogPtr.data(); + if (!dialog) { + return; + } - if (icon) { - dialog->setAspectRatioMode(savedAspectRatio); - } + updateDialogPosition(); - if (q->location() != Floating) { - dialog->animatedShow(locationToDirection(q->location())); - } else { - dialog->show(); - } + KWindowSystem::setOnAllDesktops(dialog->winId(), true); + KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); - if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) { - KWindowSystem::activateWindow(dialog->winId()); - } + if (icon) { + dialog->setAspectRatioMode(savedAspectRatio); + } + + if (q->location() != Floating) { + dialog->animatedShow(locationToDirection(q->location())); + } else { + dialog->show(); + } + + if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) { + KWindowSystem::activateWindow(dialog->winId()); } } diff --git a/private/packages.cpp b/private/packages.cpp index f85d5f724..15db22924 100644 --- a/private/packages.cpp +++ b/private/packages.cpp @@ -107,6 +107,7 @@ void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent) KNS3::DownloadDialog *knsDialog = m_knsDialog.data(); if (!knsDialog) { m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent); + knsDialog->setProperty("DoNotCloseController", true); connect(knsDialog, SIGNAL(accepted()), this, SIGNAL(newWidgetBrowserFinished())); } diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index 5bcede470..5bb7723c9 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -36,6 +36,7 @@ public: void iconSizeChanged(int group); void internalTogglePopup(bool fromActivatedSignal = false); + void showDialog(); void hideTimedPopup(); void clearPopupLostFocus(); void dialogSizeChanged(); @@ -61,6 +62,7 @@ public: Plasma::AspectRatioMode savedAspectRatio; QTimer *autohideTimer; QBasicTimer delayedShowTimer; + QBasicTimer showDialogTimer; QPoint clicked; ItemStatus preShowStatus; bool popupLostFocus : 1; From 64373cf1da735dd808a10ec952f8783260863e8e Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 16 Dec 2011 14:52:16 +0100 Subject: [PATCH 7/9] sanity check the y just as we do the x --- corona.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/corona.cpp b/corona.cpp index f9cb07d01..366a9df01 100644 --- a/corona.cpp +++ b/corona.cpp @@ -482,7 +482,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig } } - kDebug() << actualItem; + //kDebug() << actualItem; if (actualItem) { v = viewFor(actualItem); @@ -618,6 +618,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig } pos.rx() = qMax(0, pos.x()); + pos.ry() = qMax(0, pos.y()); return pos; } From d6e06ff92db481fec7a92d9938b64bc191fbf32c Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 16 Dec 2011 14:57:20 +0100 Subject: [PATCH 8/9] allow controlling the resize a bit more this allows e.g. popupapplet to put constraints on where the edges of the window can resize to and react differently when the user is actively resizing the dialog. CCBUG:227095 --- dialog.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++--- dialog.h | 25 ++++++++++++++++++++ private/dialog_p.h | 8 +++++++ 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/dialog.cpp b/dialog.cpp index 5040b080e..e192bd90d 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -490,8 +490,27 @@ void Dialog::mouseMoveEvent(QMouseEvent *event) break; } - if ((newWidth >= minimumSize().width()) && (newHeight >= minimumSize().height())) { - setGeometry(QRect(position, QSize(newWidth, newHeight))); + QRect newGeom(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); } } @@ -518,9 +537,9 @@ void Dialog::mousePressEvent(QMouseEvent *event) void Dialog::mouseReleaseEvent(QMouseEvent *event) { if (d->resizeStartCorner != Dialog::NoCorner) { + emit dialogResized(); d->resizeStartCorner = Dialog::NoCorner; unsetCursor(); - emit dialogResized(); } QWidget::mouseReleaseEvent(event); @@ -745,6 +764,38 @@ Dialog::ResizeCorners Dialog::resizeCorners() const 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) { if (!isVisible()) { diff --git a/dialog.h b/dialog.h index a8a53f7ca..d8d19c024 100644 --- a/dialog.h +++ b/dialog.h @@ -97,6 +97,31 @@ class PLASMA_EXPORT Dialog : public QWidget */ 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 * the dialog will simply hide. diff --git a/private/dialog_p.h b/private/dialog_p.h index 2a3bbda44..483c252e0 100644 --- a/private/dialog_p.h +++ b/private/dialog_p.h @@ -40,6 +40,10 @@ public: view(0), resizeCorners(Dialog::NoCorner), resizeStartCorner(Dialog::NoCorner), + leftResizeMin(-1), + topResizeMin(-1), + rightResizeMin(-1), + bottomResizeMin(-1), moveTimer(0), aspectRatioMode(Plasma::IgnoreAspectRatio), resizeChecksWithBorderCheck(false) @@ -72,6 +76,10 @@ public: Dialog::ResizeCorners resizeCorners; QMap resizeAreas; int resizeStartCorner; + int leftResizeMin; + int topResizeMin; + int rightResizeMin; + int bottomResizeMin; QTimer *moveTimer; QTimer *adjustViewTimer; QTimer *adjustSizeTimer; From ca915b0e6c0cf111973e9935c8cce67a7936742f Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 16 Dec 2011 14:58:39 +0100 Subject: [PATCH 9/9] allow resizing from both relevant corners of a popup dialog also significantly cleans up the popup positioning code and fixes a lurking bug where width() was used instead of height() BUG:227095 --- popupapplet.cpp | 88 ++++++++++++++--------------------------- private/popupapplet_p.h | 2 +- 2 files changed, 31 insertions(+), 59 deletions(-) diff --git a/popupapplet.cpp b/popupapplet.cpp index bb407ca12..dd983fd21 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -813,7 +813,7 @@ void PopupAppletPrivate::dialogSizeChanged() sizeGroup.writeEntry("DialogHeight", dialog->height()); sizeGroup.writeEntry("DialogWidth", dialog->width()); - updateDialogPosition(); + updateDialogPosition(!dialog->isUserResizing()); emit q->configNeedsSaving(); emit q->appletTransformedByUser(); @@ -903,7 +903,7 @@ void PopupAppletPrivate::restoreDialogSize() } } -void PopupAppletPrivate::updateDialogPosition() +void PopupAppletPrivate::updateDialogPosition(bool move) { Plasma::Dialog *dialog = dialogPtr.data(); if (!dialog) { @@ -920,85 +920,57 @@ void PopupAppletPrivate::updateDialogPosition() return; } - QSize s = dialog->size(); - QPoint pos = view->mapFromScene(q->scenePos()); + const QPoint appletPos = view->mapToGlobal(view->mapFromScene(q->scenePos())); + QPoint dialogPos; 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 { - 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; if (q->formFactor() == Plasma::Vertical) { - if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog->size().width()/2) { - reverse = true; - } + reverse = (appletPos.y() + (q->size().height() / 2)) < (dialogPos.y() + (dialog->size().height() / 2)); + dialog->setMinimumResizeLimits(-1, appletPos.y(), -1, appletPos.y() + q->size().height()); } else { - if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog->size().width()/2) { - reverse = true; - } + reverse = (appletPos.x() + (q->size().width() / 2)) < (dialogPos.x() + (dialog->size().width() / 2)); + dialog->setMinimumResizeLimits(appletPos.x(), -1, appletPos.x() + q->size().width(), -1); } + Dialog::ResizeCorners resizeCorners = Dialog::NoCorner; switch (q->location()) { case BottomEdge: - if (pos.x() >= q->pos().x()) { - dialog->setResizeHandleCorners(Dialog::NorthEast); - } else { - dialog->setResizeHandleCorners(Dialog::NorthWest); - } - - if (reverse) { - popupPlacement = Plasma::TopPosedLeftAlignedPopup; - } else { - popupPlacement = Plasma::TopPosedRightAlignedPopup; - } + resizeCorners = Dialog::NorthEast | Dialog::NorthWest; + popupPlacement = reverse ? TopPosedLeftAlignedPopup : TopPosedRightAlignedPopup; break; case TopEdge: - if (pos.x() >= q->pos().x()) { - dialog->setResizeHandleCorners(Dialog::SouthEast); - } else { - dialog->setResizeHandleCorners(Dialog::SouthWest); - } - - if (reverse) { - popupPlacement = Plasma::BottomPosedLeftAlignedPopup; - } else { - popupPlacement = Plasma::BottomPosedRightAlignedPopup; - } + resizeCorners = Dialog::SouthEast | Dialog::SouthWest; + popupPlacement = reverse ? Plasma::BottomPosedLeftAlignedPopup : Plasma::BottomPosedRightAlignedPopup; break; case LeftEdge: - if (pos.y() >= q->pos().y()) { - dialog->setResizeHandleCorners(Dialog::SouthEast); - } else { - dialog->setResizeHandleCorners(Dialog::NorthEast); - } - - if (reverse) { - popupPlacement = Plasma::RightPosedTopAlignedPopup; - } else { - popupPlacement = Plasma::RightPosedBottomAlignedPopup; - } + resizeCorners = Dialog::SouthEast | Dialog::NorthEast; + popupPlacement = reverse ? RightPosedTopAlignedPopup : RightPosedBottomAlignedPopup; break; case RightEdge: - if (pos.y() >= q->pos().y()) { - dialog->setResizeHandleCorners(Dialog::SouthWest); - } else { - dialog->setResizeHandleCorners(Dialog::NorthWest); - } - - if (reverse) { - popupPlacement = Plasma::LeftPosedTopAlignedPopup; - } else { - popupPlacement = Plasma::LeftPosedBottomAlignedPopup; - } + resizeCorners = Dialog::SouthWest | Dialog::NorthWest; + popupPlacement = reverse ? LeftPosedTopAlignedPopup : LeftPosedBottomAlignedPopup; break; + default: - dialog->setResizeHandleCorners(Dialog::NorthEast); + popupPlacement = FloatingPopup; + resizeCorners = Dialog::All; + break; } - dialog->move(pos); + dialog->setResizeHandleCorners(resizeCorners); + if (move) { + dialog->move(dialogPos); + } } } // Plasma namespace diff --git a/private/popupapplet_p.h b/private/popupapplet_p.h index 5bb7723c9..1a00e3d06 100644 --- a/private/popupapplet_p.h +++ b/private/popupapplet_p.h @@ -42,7 +42,7 @@ public: void dialogSizeChanged(); void dialogStatusChanged(bool status); void restoreDialogSize(); - void updateDialogPosition(); + void updateDialogPosition(bool move = true); void popupConstraintsEvent(Plasma::Constraints constraints); void checkExtenderAppearance(Plasma::FormFactor f); KConfigGroup popupConfigGroup();