2d4971eb46
* Far more correct spacer implementation. This avoids the spacer jumping around while dragging an item. Also adjustSizeHints is now only called once/spacer move. * Avoid spacer related memleak. * Only load extenderItems that are actually detached. This way, attached items won't linger around in case of a plasma crash. * Use utilities-desktop-extra as icon for items with no saved icon (e.g. items where the icon is set using setIcon(QIcon) instead of setIcon(QString)). Sure beats the questionmark. * Update mask when offscreen extender items are resized when being dragged to avoid screwed up masks (white borders). * Start the drag only aften being moved a minimum of QApplication::startDragDistance(). * Correct transformation for calls to showDropZone. * Use the mouse position for positioning items in extenders or panels, the topleft corner for positioning in a desktop containment. This feels the most natural. * Move items back to the extender they came from when they're dropped into nowhere. * Some small code style fixes. svn path=/trunk/KDE/kdelibs/; revision=890249
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
/*
|
|
* Copyright 2008 by Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include "extenderapplet_p.h"
|
|
|
|
#include "../extender.h"
|
|
#include "../extenderitem.h"
|
|
|
|
#include <QGraphicsLinearLayout>
|
|
|
|
ExtenderApplet::ExtenderApplet(QObject *parent, const QVariantList &args)
|
|
: Plasma::PopupApplet(parent, args)
|
|
{
|
|
}
|
|
|
|
ExtenderApplet::~ExtenderApplet()
|
|
{
|
|
}
|
|
|
|
void ExtenderApplet::init()
|
|
{
|
|
setPopupIcon("utilities-desktop-extra");
|
|
|
|
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
|
|
layout->setSpacing(0);
|
|
setLayout(layout);
|
|
|
|
extender()->setAppearance(Plasma::Extender::NoBorders);
|
|
extender()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
|
|
|
connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)),
|
|
this, SLOT(itemDetached(Plasma::ExtenderItem*)));
|
|
|
|
layout->addItem(extender());
|
|
//updateGeometry();
|
|
}
|
|
|
|
void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
|
|
{
|
|
if (extender()->attachedItems().isEmpty()) {
|
|
destroy();
|
|
}
|
|
}
|
|
|
|
#include "extenderapplet_p.moc"
|
|
|