diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktopPluginSpace.h | 11 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/LDPlugin.h | 5 | ||||
-rw-r--r-- | lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lumina-desktop/LDesktopPluginSpace.h b/lumina-desktop/LDesktopPluginSpace.h index b3904711..8e4c31c2 100644 --- a/lumina-desktop/LDesktopPluginSpace.h +++ b/lumina-desktop/LDesktopPluginSpace.h @@ -20,8 +20,6 @@ #include "desktop-plugins/LDPlugin.h" #define MIMETYPE QString("x-special/lumina-desktop-plugin") -//#define MIMEPOS QString("x-special/lumina-desktop-plugin-pos") -//#define GRIDSIZE 64.0 //Need this to be a double/float - usually used for divisions class LDesktopPluginSpace : public QWidget{ Q_OBJECT @@ -181,16 +179,15 @@ protected: if(ValidGeometry(act.section("::::",1,50), geom)){ //qDebug() << " - Is valid"; item->setGeometry(geom); + item->setFixedSize(geom.size()); //needed due to resizing limitations and such for some plugins ev->acceptProposedAction(); item->savePluginGeometry(geom); //save in pixel coords }else{ ev->ignore(); } //invalid location }else{ //Resize operation - QPoint diff = ev->pos() - geom.center(); //need difference from center (pixels) - if(qAbs(diff.x())<GRIDSIZE/4 && qAbs(diff.y())<GRIDSIZE/4){ - ev->acceptProposedAction(); //nothing to do - but keep the drag active - }else{ + QPoint diff = ev->pos() - (geom.center()-QPoint(1,1)); //need difference from center (pixels) + //Note: Use the 1x1 pixel offset to ensure that the center point is not exactly on a grid point intersection (2x2, 4x4, etc) //qDebug() << "Resize Plugin:" << geom << grid << posToGrid(geom.center()) << diff; geom = geomToGrid(geom); //convert to grid coordinates now //qDebug() << " - Grid Geom:" << geom; @@ -206,11 +203,11 @@ protected: //Check Validity of new geom if(ValidGeometry(act.section("::::",1,50), geom)){ item->setGeometry(geom); + item->setFixedSize(geom.size()); //needed due to resizing limitations and such for some plugins ev->acceptProposedAction(); item->savePluginGeometry(geom); //save in pixel coords }else{ ev->ignore(); } //invalid location } - } } }else if(ev->mimeData()->hasUrls()){ ev->acceptProposedAction(); //allow this to be dropped here diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h index 521a89f4..d1a9c743 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.h +++ b/lumina-desktop/desktop-plugins/LDPlugin.h @@ -141,7 +141,10 @@ protected: } QWidget::mouseMoveEvent(ev); } - + void resizeEvent(QResizeEvent *ev){ + emit PluginResized(); + QFrame::resizeEvent(ev); //do normal processing + } }; #endif diff --git a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h index e9652e17..133a3af6 100644 --- a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h +++ b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h @@ -33,6 +33,7 @@ public: timer->setInterval(1800000); //30 minute refresh timer timer->start(); QTimer::singleShot(0,this, SLOT(updateDate()) ); + connect(this, SIGNAL(PluginResized()), this, SLOT(UpdateCalendarSize())); } ~CalendarPlugin(){ timer->stop(); } @@ -44,6 +45,9 @@ private slots: cal->showSelectedDate(); } } + void UpdateCalendarSize(){ + cal->setFixedSize(this->size()); + } }; |