summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/koagenda.cpp25
-rw-r--r--korganizer/koagendaitem.cpp18
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/koeventviewerdialog.cpp11
5 files changed, 68 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1009956..d6918d3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -467,32 +467,33 @@ void CalendarView::init()
connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete beamDialog;
+ delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::showDay( QDate d )
{
dateNavigator()->blockSignals( true );
dateNavigator()->selectDate( d );
dateNavigator()->blockSignals( false );
mViewManager->showDayView();
//dateNavigator()->selectDate( d );
}
void CalendarView::timerAlarm()
{
//qDebug("CalendarView::timerAlarm() ");
computeAlarm(mAlarmNotification );
}
@@ -2514,49 +2515,61 @@ void CalendarView::showDatePickerPopup()
int dh = QApplication::desktop()->height();
#endif
mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
mDateFrame->show();
}
}
void CalendarView::showDatePicker( )
{
showDatePickerPopup();
mDatePickerMode = 1;
mDatePicker->setDate( mNavigator->selectedDates().first() );
}
void CalendarView::showEventEditor()
{
#ifdef DESKTOP_VERSION
+ int x,y,w,h;
+ x = mEventEditor->geometry().x();
+ y = mEventEditor->geometry().y();
+ w = mEventEditor->width();
+ h = mEventEditor->height();
mEventEditor->show();
+ mEventEditor->setGeometry(x,y,w,h);
#else
if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
qApp->processEvents();
delete mEventEditor;
mEventEditor = mDialogManager->getEventEditor();
topLevelWidget()->setCaption( i18n("") );
}
mEventEditor->showMaximized();
#endif
}
void CalendarView::showTodoEditor()
{
#ifdef DESKTOP_VERSION
+ int x,y,w,h;
+ x = mTodoEditor->geometry().x();
+ y = mTodoEditor->geometry().y();
+ w = mTodoEditor->width();
+ h = mTodoEditor->height();
mTodoEditor->show();
+ mTodoEditor->setGeometry(x,y,w,h);
#else
if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
qApp->processEvents();
delete mTodoEditor;
mTodoEditor = mDialogManager->getTodoEditor();
topLevelWidget()->setCaption( i18n("") );
}
mTodoEditor->showMaximized();
#endif
}
void CalendarView::cloneIncidence()
{
Incidence *incidence = currentSelection();
@@ -2780,33 +2793,33 @@ void CalendarView::editTodo( Todo *todo )
if ( !todo ) return;
if ( todo->isReadOnly() ) {
showTodo( todo );
return;
}
showTodoEditor();
mTodoEditor->editTodo( todo ,mFlagEditDescription);
mTodoEditor->exec();
setActiveWindow();
}
KOEventViewerDialog* CalendarView::getEventViewerDialog()
{
if ( !mEventViewerDialog ) {
- mEventViewerDialog = new KOEventViewerDialog(this);
+ mEventViewerDialog = new KOEventViewerDialog(0);
connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
viewManager(), SLOT( showAgendaView( bool ) ) );
connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
this, SLOT( slotViewerClosed() ) );
connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
this, SLOT( todoChanged(Todo *) ) );
mEventViewerDialog->resize( 640, 480 );
}
return mEventViewerDialog;
}
void CalendarView::showEvent(Event *event)
@@ -3954,21 +3967,22 @@ void CalendarView::slotViewerClosed()
QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
}
void CalendarView::resetFocus()
{
if ( mViewerCallerIsSearchDialog ) {
if ( mDialogManager->getSearchDialog()->isVisible() ){
mDialogManager->getSearchDialog()->raise();
mDialogManager->getSearchDialog()->setActiveWindow();
mDialogManager->getSearchDialog()->listview()->resetFocus();
} else
mViewerCallerIsSearchDialog = false;
}
if ( !mViewerCallerIsSearchDialog ) {
//mViewManager->currentView()->setFocus();
//qDebug("sssssssssssssssset focus ");
+ topLevelWidget()->raise();
setActiveWindow();
//setFocus();
}
mViewerCallerIsSearchDialog = false;
}
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 195b1fa..ec81d44 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1168,33 +1168,56 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
//qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
}
}
//qDebug("btbl ");
p->begin( pd );
//qDebug("end ");
}
void KOAgenda::finishUpdate()
{
KOAgendaItem *item;
- globalFlagBlockAgendaItemPaint = 1;
+ globalFlagBlockAgendaItemPaint = 1;
+ // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
+ for ( item=mItems.first(); item != 0; item=mItems.next() ) {
+ if ( !item->checkLayout() ) {
+ //qDebug(" conflictitem found ");
+ int newSubCellWidth;
+ if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
+ else newSubCellWidth = mGridSpacingX / item->subCells();
+
+ if (mAllDayMode) {
+ item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
+ } else {
+ item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
+ }
+ int x,y;
+ gridToContents(item->cellX(),item->cellYTop(),x,y);
+ if (mAllDayMode) {
+ y += item->subCell() * newSubCellWidth;
+ } else {
+ x += item->subCell() * newSubCellWidth;
+ }
+ moveChild(item,x,y);
+ }
+ }
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( !item->isVisible() )
item->show();
}
globalFlagBlockAgendaItemUpdate = 0;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
item->repaintMe( );
}
globalFlagBlockAgendaItemUpdate = 1;
qApp->processEvents();
globalFlagBlockAgendaItemPaint = 0;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
item->repaint( false );
}
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 38bd93a..042a789 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -751,16 +751,34 @@ QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
{
mConflictItems = ci;
KOAgendaItem *item;
for ( item=mConflictItems.first(); item != 0;
item=mConflictItems.next() ) {
item->addConflictItem(this);
}
}
void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
{
if (mConflictItems.find(ci)<0)
mConflictItems.append(ci);
}
+
+bool KOAgendaItem::checkLayout()
+{
+ if ( !mConflictItems.count() )
+ return true;
+ int max = 0;
+ KOAgendaItem *item;
+ for ( item=mConflictItems.first(); item != 0;
+ item=mConflictItems.next() ) {
+ if ( item->subCells() > max )
+ max = item->subCells();
+ }
+ if ( max > subCells() ) {
+ setSubCells( max );
+ return false;
+ }
+ return true;
+}
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 5b8f420..b4dba79 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -94,32 +94,33 @@ class KOAgendaItem : public QWidget
virtual bool eventFilter ( QObject *, QEvent * );
static QToolTipGroup *toolTipGroup();
QPtrList<KOAgendaItem> conflictItems();
void setConflictItems(QPtrList<KOAgendaItem>);
void addConflictItem(KOAgendaItem *ci);
void paintMe( bool, QPainter* painter = 0 );
void repaintMe();
static void resizePixmap( int, int );
static QPixmap * paintPix();
static QPixmap * paintPixSel();
static QPixmap * paintPixAllday();
void updateItem();
void computeText();
void recreateIncidence();
+ bool checkLayout();
public slots:
bool updateIcons( QPainter *, bool );
void select(bool=true);
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void paintEvent ( QPaintEvent * );
void resizeEvent ( QResizeEvent *ev );
private:
bool mAllDay;
int mCellX;
int mCellXWidth;
int mCellYTop,mCellYBottom;
int mSubCell; // subcell number of this item
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 8bada3b..e2c8e6e 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -61,36 +61,43 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
// setMinimumSize(300,200);
// resize(320,300);
// }
mSyncMode = false;
mSyncResult = 0;
}
KOEventViewerDialog::~KOEventViewerDialog()
{
//qDebug("-------~KOEventViewerDialog() ");
}
void KOEventViewerDialog::showMe()
{
#ifdef DESKTOP_VERSION
+ int x,y,w,h;
+ x = geometry().x();
+ y = geometry().y();
+ w = width();
+ h = height();
show();
+ setGeometry(x,y,w,h);
#else
showMaximized();
#endif
+ raise();
setActiveWindow();
mEventViewer->setFocus();
}
void KOEventViewerDialog::setSyncMode( bool b )
{
mSyncMode = b;
//qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
if ( mSyncMode ) {
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
} else {
findButton( Close )->setText( i18n("Close"));
findButton( Ok )->setText( i18n("Edit"));
findButton( User1 )->setText( i18n("Agenda"));
@@ -245,33 +252,35 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_A :
case Qt::Key_L :
showIncidence();
break;
case Qt::Key_E :
case Qt::Key_R :
editIncidence();
break;
case Qt::Key_C:
case Qt::Key_Escape:
close();
break;
case Qt::Key_I:
- accept();
+ sendSignalViewerClosed = true;
+ slotViewerClosed();
+ //accept();
break;
default:
KDialogBase::keyPressEvent ( e );
break;
}
}
void KOEventViewerDialog::hideEvent ( QHideEvent * e )
{
KDialogBase::hideEvent ( e );
QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) );
}
void KOEventViewerDialog::slotViewerClosed()
{
if ( sendSignalViewerClosed ) {