From 4a9bf75c2ef12a40be3aea1d147f3703aee48638 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 23 Feb 2005 21:53:18 +0000 Subject: morelayout fixes --- (limited to 'korganizer') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1009956..d6918d3 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -480,6 +480,7 @@ CalendarView::~CalendarView() delete mStorage; delete mDateFrame ; delete beamDialog; + delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } @@ -2527,7 +2528,13 @@ void CalendarView::showDatePicker( ) 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...") ); @@ -2543,7 +2550,13 @@ void CalendarView::showEventEditor() 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...") ); @@ -2793,7 +2806,7 @@ void CalendarView::editTodo( Todo *todo ) 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 &)), @@ -3967,6 +3980,7 @@ void CalendarView::resetFocus() if ( !mViewerCallerIsSearchDialog ) { //mViewManager->currentView()->setFocus(); //qDebug("sssssssssssssssset focus "); + topLevelWidget()->raise(); setActiveWindow(); //setFocus(); } diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 195b1fa..ec81d44 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1181,7 +1181,30 @@ 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(); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 38bd93a..042a789 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -764,3 +764,21 @@ 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 @@ -107,6 +107,7 @@ class KOAgendaItem : public QWidget void updateItem(); void computeText(); void recreateIncidence(); + bool checkLayout(); public slots: bool updateIcons( QPainter *, bool ); void select(bool=true); diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 8bada3b..e2c8e6e 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp @@ -74,10 +74,17 @@ 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(); @@ -258,7 +265,9 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) close(); break; case Qt::Key_I: - accept(); + sendSignalViewerClosed = true; + slotViewerClosed(); + //accept(); break; default: KDialogBase::keyPressEvent ( e ); -- cgit v0.9.0.2