author | zautrix <zautrix> | 2005-03-26 15:39:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 15:39:48 (UTC) |
commit | 5079ed1883f8e53bc12be971c3c9495f45abf341 (patch) (unidiff) | |
tree | b145c9c6f086ce96e75363d70c06563b5f54fa81 | |
parent | 98444f8937b151a3deb71b7ae0da495872c52855 (diff) | |
download | kdepimpi-5079ed1883f8e53bc12be971c3c9495f45abf341.zip kdepimpi-5079ed1883f8e53bc12be971c3c9495f45abf341.tar.gz kdepimpi-5079ed1883f8e53bc12be971c3c9495f45abf341.tar.bz2 |
layout fix
-rw-r--r-- | korganizer/koagenda.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 14f52b8..ed7a443 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -325,63 +325,54 @@ void KOAgenda::clear() | |||
325 | mUnusedItems.append( item ); | 325 | mUnusedItems.append( item ); |
326 | //item->hide(); | 326 | //item->hide(); |
327 | } | 327 | } |
328 | mItems.clear(); | 328 | mItems.clear(); |
329 | mSelectedItem = 0; | 329 | mSelectedItem = 0; |
330 | clearSelection(); | 330 | clearSelection(); |
331 | } | 331 | } |
332 | 332 | ||
333 | void KOAgenda::clearSelection() | 333 | void KOAgenda::clearSelection() |
334 | { | 334 | { |
335 | mSelectionCellX = 0; | 335 | mSelectionCellX = 0; |
336 | mSelectionYTop = 0; | 336 | mSelectionYTop = 0; |
337 | mSelectionHeight = 0; | 337 | mSelectionHeight = 0; |
338 | } | 338 | } |
339 | 339 | ||
340 | void KOAgenda::marcus_bains() | 340 | void KOAgenda::marcus_bains() |
341 | { | 341 | { |
342 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 342 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
343 | } | 343 | } |
344 | 344 | ||
345 | 345 | ||
346 | void KOAgenda::changeColumns(int columns) | 346 | void KOAgenda::changeColumns(int columns) |
347 | { | 347 | { |
348 | if (columns == 0) { | 348 | if (columns == 0) { |
349 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; | 349 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
350 | return; | 350 | return; |
351 | } | 351 | } |
352 | |||
353 | clear(); | 352 | clear(); |
354 | |||
355 | mColumns = columns; | 353 | mColumns = columns; |
356 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); | ||
357 | // init(); | ||
358 | // update(); | ||
359 | //qDebug("KOAgenda::changeColumns "); | ||
360 | computeSizes(); | 354 | computeSizes(); |
361 | // QResizeEvent event( size(), size() ); | ||
362 | |||
363 | //QApplication::sendEvent( this, &event ); | ||
364 | } | 355 | } |
365 | 356 | ||
366 | /* | 357 | /* |
367 | This is the eventFilter function, which gets all events from the KOAgendaItems | 358 | This is the eventFilter function, which gets all events from the KOAgendaItems |
368 | contained in the agenda. It has to handle moving and resizing for all items. | 359 | contained in the agenda. It has to handle moving and resizing for all items. |
369 | */ | 360 | */ |
370 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 361 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
371 | { | 362 | { |
372 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 363 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
373 | switch(event->type()) { | 364 | switch(event->type()) { |
374 | case QEvent::MouseButtonPress: | 365 | case QEvent::MouseButtonPress: |
375 | case QEvent::MouseButtonDblClick: | 366 | case QEvent::MouseButtonDblClick: |
376 | case QEvent::MouseButtonRelease: | 367 | case QEvent::MouseButtonRelease: |
377 | case QEvent::MouseMove: | 368 | case QEvent::MouseMove: |
378 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 369 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
379 | 370 | ||
380 | case (QEvent::Leave): | 371 | case (QEvent::Leave): |
381 | if (!mActionItem) | 372 | if (!mActionItem) |
382 | setCursor(arrowCursor); | 373 | setCursor(arrowCursor); |
383 | return true; | 374 | return true; |
384 | 375 | ||
385 | default: | 376 | default: |
386 | return QScrollView::eventFilter(object,event); | 377 | return QScrollView::eventFilter(object,event); |
387 | } | 378 | } |
@@ -1727,61 +1718,58 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | |||
1727 | item = insertItem(todo,currentDate,days,startY,endY); | 1718 | item = insertItem(todo,currentDate,days,startY,endY); |
1728 | item->show(); | 1719 | item->show(); |
1729 | } | 1720 | } |
1730 | qApp->processEvents(); | 1721 | qApp->processEvents(); |
1731 | globalFlagBlockAgendaItemPaint = 0; | 1722 | globalFlagBlockAgendaItemPaint = 0; |
1732 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1723 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1733 | KOAgendaItem *itemit; | 1724 | KOAgendaItem *itemit; |
1734 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1725 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1735 | itemit=oldconflictItems.next() ) { | 1726 | itemit=oldconflictItems.next() ) { |
1736 | globalFlagBlockAgendaItemUpdate = 0; | 1727 | globalFlagBlockAgendaItemUpdate = 0; |
1737 | itemit->repaintMe(); | 1728 | itemit->repaintMe(); |
1738 | globalFlagBlockAgendaItemUpdate = 1; | 1729 | globalFlagBlockAgendaItemUpdate = 1; |
1739 | itemit->repaint(); | 1730 | itemit->repaint(); |
1740 | } | 1731 | } |
1741 | globalFlagBlockAgendaItemUpdate = 0; | 1732 | globalFlagBlockAgendaItemUpdate = 0; |
1742 | item->repaintMe(); | 1733 | item->repaintMe(); |
1743 | globalFlagBlockAgendaItemUpdate = 1; | 1734 | globalFlagBlockAgendaItemUpdate = 1; |
1744 | item->repaint(); | 1735 | item->repaint(); |
1745 | } | 1736 | } |
1746 | /* | 1737 | /* |
1747 | Insert KOAgendaItem into agenda. | 1738 | Insert KOAgendaItem into agenda. |
1748 | */ | 1739 | */ |
1749 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) | 1740 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) |
1750 | { | 1741 | { |
1751 | //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl; | ||
1752 | |||
1753 | if (mAllDayMode) { | 1742 | if (mAllDayMode) { |
1754 | kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl; | 1743 | qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); |
1755 | return 0; | 1744 | return 0; |
1756 | } | 1745 | } |
1757 | 1746 | ||
1758 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1747 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1759 | //agendaItem->setFrameStyle(WinPanel|Raised); | 1748 | //agendaItem->setFrameStyle(WinPanel|Raised); |
1760 | 1749 | ||
1761 | int YSize = YBottom - YTop + 1; | 1750 | int YSize = YBottom - YTop + 1; |
1762 | if (YSize < 0) { | 1751 | if (YSize < 0) { |
1763 | kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl; | ||
1764 | YSize = 1; | 1752 | YSize = 1; |
1765 | } | 1753 | } |
1766 | int iheight = mGridSpacingY * YSize; | 1754 | int iheight = mGridSpacingY * YSize; |
1767 | 1755 | ||
1768 | agendaItem->resize(mGridSpacingX,iheight ); | 1756 | agendaItem->resize(mGridSpacingX,iheight ); |
1769 | agendaItem->setCellXY(X,YTop,YBottom); | 1757 | agendaItem->setCellXY(X,YTop,YBottom); |
1770 | agendaItem->setCellXWidth(X); | 1758 | agendaItem->setCellXWidth(X); |
1771 | 1759 | ||
1772 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); | 1760 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); |
1773 | mItems.append(agendaItem); | 1761 | mItems.append(agendaItem); |
1774 | 1762 | ||
1775 | placeSubCells(agendaItem); | 1763 | placeSubCells(agendaItem); |
1776 | 1764 | ||
1777 | //agendaItem->show(); | 1765 | //agendaItem->show(); |
1778 | 1766 | ||
1779 | marcus_bains(); | 1767 | marcus_bains(); |
1780 | 1768 | ||
1781 | return agendaItem; | 1769 | return agendaItem; |
1782 | } | 1770 | } |
1783 | 1771 | ||
1784 | 1772 | ||
1785 | /* | 1773 | /* |
1786 | Insert all-day KOAgendaItem into agenda. | 1774 | Insert all-day KOAgendaItem into agenda. |
1787 | */ | 1775 | */ |
@@ -1869,69 +1857,69 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | |||
1869 | //} | 1857 | //} |
1870 | void KOAgenda::finishResize ( ) | 1858 | void KOAgenda::finishResize ( ) |
1871 | { | 1859 | { |
1872 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); | 1860 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); |
1873 | if ( globalFlagBlockAgenda == 0 ) { | 1861 | if ( globalFlagBlockAgenda == 0 ) { |
1874 | finishUpdate(); | 1862 | finishUpdate(); |
1875 | //qDebug("finishUpdate() called "); | 1863 | //qDebug("finishUpdate() called "); |
1876 | } | 1864 | } |
1877 | } | 1865 | } |
1878 | /* | 1866 | /* |
1879 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. | 1867 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. |
1880 | */ | 1868 | */ |
1881 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) | 1869 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) |
1882 | { | 1870 | { |
1883 | 1871 | ||
1884 | mResizeTimer.start( 150 , true ); | 1872 | mResizeTimer.start( 150 , true ); |
1885 | computeSizes(); | 1873 | computeSizes(); |
1886 | return; | 1874 | return; |
1887 | 1875 | ||
1888 | } | 1876 | } |
1889 | void KOAgenda::computeSizes() | 1877 | void KOAgenda::computeSizes() |
1890 | { | 1878 | { |
1891 | if ( globalFlagBlockStartup ) | 1879 | if ( globalFlagBlockStartup ) |
1892 | return; | 1880 | return; |
1893 | 1881 | int frameOffset = frameWidth() * 2 +1; | |
1894 | if (mAllDayMode) { | 1882 | if (mAllDayMode) { |
1895 | mGridSpacingX = (width()-3) / mColumns; | 1883 | mGridSpacingX = (width()-frameOffset) / mColumns; |
1896 | mGridSpacingY = height() - 2 * frameWidth() - 1; | 1884 | mGridSpacingY = height() - 2 * frameWidth() - 1; |
1897 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); | 1885 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); |
1898 | // mGridSpacingY = height(); | 1886 | // mGridSpacingY = height(); |
1899 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1887 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1900 | 1888 | ||
1901 | KOAgendaItem *item; | 1889 | KOAgendaItem *item; |
1902 | int subCellWidth; | 1890 | int subCellWidth; |
1903 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1891 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1904 | subCellWidth = mGridSpacingY / item->subCells(); | 1892 | subCellWidth = mGridSpacingY / item->subCells(); |
1905 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1893 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); |
1906 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1894 | moveChild(item,KOGlobals::self()->reverseLayout() ? |
1907 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1895 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1908 | item->cellX() * mGridSpacingX, | 1896 | item->cellX() * mGridSpacingX, |
1909 | item->subCell() * subCellWidth); | 1897 | item->subCell() * subCellWidth); |
1910 | } | 1898 | } |
1911 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; | 1899 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; |
1912 | } else { | 1900 | } else { |
1913 | mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; | 1901 | mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; |
1914 | if (height() > mGridSpacingY * mRows + 1 ) { | 1902 | if (height() > mGridSpacingY * mRows + 1 ) { |
1915 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; | 1903 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; |
1916 | mGridSpacingY = KOPrefs::instance()->mHourSize ; | 1904 | mGridSpacingY = KOPrefs::instance()->mHourSize ; |
1917 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1905 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1918 | emit resizedSignal(); | 1906 | emit resizedSignal(); |
1919 | } else | 1907 | } else |
1920 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1908 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1921 | KOAgendaItem *item; | 1909 | KOAgendaItem *item; |
1922 | int subCellWidth; | 1910 | int subCellWidth; |
1923 | 1911 | ||
1924 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1912 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1925 | subCellWidth = mGridSpacingX / item->subCells(); | 1913 | subCellWidth = mGridSpacingX / item->subCells(); |
1926 | item->resize(subCellWidth,item->height()); | 1914 | item->resize(subCellWidth,item->height()); |
1927 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1915 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1928 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1916 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1929 | item->cellX() * mGridSpacingX) + | 1917 | item->cellX() * mGridSpacingX) + |
1930 | item->subCell() * subCellWidth,childY(item)); | 1918 | item->subCell() * subCellWidth,childY(item)); |
1931 | } | 1919 | } |
1932 | } | 1920 | } |
1933 | int cw = contentsWidth(); | 1921 | int cw = contentsWidth(); |
1934 | int ch = contentsHeight(); | 1922 | int ch = contentsHeight(); |
1935 | if ( mAllDayMode ) { | 1923 | if ( mAllDayMode ) { |
1936 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1924 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1937 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) | 1925 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) |