summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp21
-rw-r--r--microkde/KDGanttMinimizeSplitter.h5
3 files changed, 22 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 7927307..8ee1363 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -761,25 +761,25 @@ int MonthViewCell::insertEvent(Event *event)
} else
item->setReply(false);
#endif
item->setMultiDay( multiday );
if ( multiday ) {
insertItem( item ,mdayCount);
++mdayCount;
} else {
uint i;
int pos = mdayCount;
for ( i = mdayCount; i < count();++i ) {
QListBoxItem* it = this->item ( i );
- if ( text < it->text() ) {
+ if ( it && text < it->text() ) {
pos = i;
break;
}
++pos;
}
insertItem( item ,pos);
}
if ( useToolTips ) {
mToolTip.append( mToolTipText );
}
return mdayCount;
}
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index fb5d4e3..72c4e60 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -43,36 +43,49 @@
#else
#include <qlist.h>
#include <qarray.h>
#define QPtrList QList
#define QMemArray QArray
#endif
#include "qlayoutengine_p.h"
#include "qobjectlist.h"
#include "qstyle.h"
#include "qapplication.h" //sendPostedEvents
#include <qvaluelist.h>
#include <qcursor.h>
+#include <qframe.h>
#ifndef KDGANTT_MASTER_CVS
//#include "KDGanttMinimizeSplitter.moc"
#endif
#ifndef DOXYGEN_SKIP_INTERNAL
#if QT_VERSION >= 232
static int mouseOffset;
static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
+class KDRubberBand: public QFrame
+{
+public:
+ KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;}
+
+protected:
+ virtual void mousePressEvent ( QMouseEvent * )
+ {
+ close();
+ };
+
+};
KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char * name )
: QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
{
if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
mSizeHint = QSize(7,7);
mUseOffset = true;
} else {
mSizeHint = QSize(6,6);
mUseOffset = false;
@@ -180,26 +193,28 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
}
_activeButton = 0;
updateCursor( e->pos() );
}
else {
if ( !opaque() && e->button() == LeftButton ) {
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
s->setRubberband( -1 );
s->moveSplitter( pos, id() );
}
}
- if ( s->rubberBand() )
- s->rubberBand()->hide();
+ if ( s->rubberBand() ) {
+ //qDebug("hide rubberband ");
+ s->rubberBand()->close();
+ }
repaint();
}
int KDGanttSplitterHandle::onButton( const QPoint& p )
{
QValueList<QPointArray> list = buttonRegions();
int index = 1;
int add = 12;
for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
QRect rect = (*it).boundingRect();
rect.setLeft( rect.left()- add );
rect.setRight( rect.right() + add);
@@ -672,25 +687,25 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
if ( p >= 0 )
paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
} else {
if ( opaqueOldPos >= 0 )
paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
r.width(), 2*rBord );
if ( p >= 0 )
paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
}
opaqueOldPos = p;
#else
if ( !mRubberBand ) {
- mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
+ mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
mRubberBand->setFrameStyle( Box | Raised );
//mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
}
QRect r = contentsRect();
static int rBord = 0; //Themable????
if ( !rBord ) {
if (QApplication::desktop()->width() <= 320 )
rBord = 3;
else
rBord = 4;
}
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 585298d..3042e0a 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -34,24 +34,25 @@
#ifndef KDGANTTMINIMIZESPLITTER_H
#define KDGANTTMINIMIZESPLITTER_H
#ifndef QT_H
#include "qframe.h"
#include "qvaluelist.h"
#endif // QT_H
#ifndef QT_NO_SPLITTER___
class QSplitterData;
class QSplitterLayoutStruct;
class KDGanttSplitterHandle;
+class KDRubberBand;
class KDGanttMinimizeSplitter : public QFrame
{
Q_OBJECT
// Q_ENUMS( Direction )
// Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
// Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
public:
enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
enum Direction { Left, Right, Up, Down };
KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
@@ -71,45 +72,45 @@ public:
void moveToFirst( QWidget * );
void moveToLast( QWidget * );
void refresh() { recalc( TRUE ); }
QSize sizeHint() const;
QSize minimumSizeHint() const;
QValueList<int> sizes() const;
void setSizes( QValueList<int> );
KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;}
void expandPos( int id, int* min, int* max );
- QFrame* rubberBand() { return mRubberBand ;}
+ KDRubberBand* rubberBand() { return mRubberBand ;}
public slots:
void toggle();
protected:
void childEvent( QChildEvent * );
bool event( QEvent * );
void resizeEvent( QResizeEvent * );
int idAfter( QWidget* ) const;
void moveSplitter( QCOORD pos, int id );
virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
QCOORD w, QCOORD h );
void styleChange( QStyle& );
int adjustPos( int , int );
virtual void setRubberband( int );
void getRange( int id, int*, int* );
private:
- QFrame* mRubberBand;
+ KDRubberBand* mRubberBand;
void init();
void recalc( bool update = FALSE );
void doResize();
void storeSizes();
void processChildEvents();
QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
void recalcId();
void moveBefore( int pos, int id, bool upLeft );
void moveAfter( int pos, int id, bool upLeft );
void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
QCOORD pick( const QPoint &p ) const