author | zautrix <zautrix> | 2005-02-23 21:53:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-23 21:53:18 (UTC) |
commit | 4a9bf75c2ef12a40be3aea1d147f3703aee48638 (patch) (side-by-side diff) | |
tree | 62b2e4d0b63487ff2818c18f8bc1a3233df46e76 | |
parent | 31f24d21cd23bb7e4033e7ffa000e6c979133ce7 (diff) | |
download | kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.zip kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.tar.gz kdepimpi-4a9bf75c2ef12a40be3aea1d147f3703aee48638.tar.bz2 |
morelayout fixes
-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 25 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 18 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 11 |
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 @@ -475,16 +475,17 @@ 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 ); @@ -2522,33 +2523,45 @@ 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("") ); @@ -2788,17 +2801,17 @@ void CalendarView::editTodo( Todo *todo ) 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() ) ); @@ -3962,13 +3975,14 @@ void CalendarView::resetFocus() 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 @@ -1176,17 +1176,40 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 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( ); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 38bd93a..042a789 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -759,8 +759,26 @@ void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) } } 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 @@ -102,16 +102,17 @@ class KOAgendaItem : public QWidget 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 * ); diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 8bada3b..e2c8e6e 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp @@ -69,20 +69,27 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) 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 ); @@ -253,17 +260,19 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * 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 ) |