kdgantt

KDGanttView.cpp

00001 /* -*- Mode: C++ -*-
00002    $Id: KDGanttView.cpp 536225 2006-05-01 16:46:33Z tilladam $
00003    KDGantt - a multi-platform charting engine
00004 */
00005 
00006 /****************************************************************************
00007  ** Copyright (C)  2002-2004 Klarälvdalens Datakonsult AB.  All rights reserved.
00008  **
00009  ** This file is part of the KDGantt library.
00010  **
00011  ** This file may be distributed and/or modified under the terms of the
00012  ** GNU General Public License version 2 as published by the Free Software
00013  ** Foundation and appearing in the file LICENSE.GPL included in the
00014  ** packaging of this file.
00015  **
00016  ** Licensees holding valid commercial KDGantt licenses may use this file in
00017  ** accordance with the KDGantt Commercial License Agreement provided with
00018  ** the Software.
00019  **
00020  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00021  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00022  **
00023  ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
00024  **   information about KDGantt Commercial License Agreements.
00025  **
00026  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
00027  ** licensing are not clear to you.
00028  **
00029  ** As a special exception, permission is given to link this program
00030  ** with any edition of Qt, and distribute the resulting executable,
00031  ** without including the source code for Qt in the source distribution.
00032  **
00033  **********************************************************************/
00034 
00035 
00036 #include "KDGanttView.h"
00037 #include "KDGanttViewSubwidgets.h"
00038 #include "KDGanttMinimizeSplitter.h"
00039 #include "KDGanttViewItem.h"
00040 #include "KDGanttXMLTools.h"
00041 #include "itemAttributeDialog.h"
00042 #include <qprinter.h>
00043 #include <qpainter.h>
00044 #include <qlayout.h>
00045 #include <qpaintdevicemetrics.h>
00046 #include <qfile.h>
00047 #include <qheader.h>
00048 #include <qscrollview.h>
00049 #include <qapplication.h>
00050 #include <qevent.h>
00051 #include <qiconview.h>
00052 
00053 #include <qmessagebox.h>
00054 #include <qfileinfo.h>
00055 
00056 #ifndef KDGANTT_MASTER_CVS
00057 #include "KDGanttView.moc"
00058 #endif
00059 
00060 #if defined KDAB_EVAL
00061 #include "../evaldialog/evaldialog.h"
00062 #endif
00063 
00083 KDGanttView::KDGanttView( QWidget* parent, const char* name  )
00084     : KDGanttMinimizeSplitter( Qt::Vertical, parent, name ),
00085       myCanvasView(0),
00086       myTimeHeaderScroll(0)
00087 {
00088 #if defined KDAB_EVAL
00089     EvalDialog::checkEvalLicense( "KD Gantt" );
00090 #endif
00091   myCurrentItem = 0;
00092     setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
00093     mySplitter = new KDGanttMinimizeSplitter( this );
00094     mySplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
00095     leftWidget = new QVBox( mySplitter );
00096     rightWidget = new QVBox( mySplitter );
00097 
00098     myLegend = new KDLegendWidget( leftWidget, this );
00099     spacerLeft = new QHBox( leftWidget );
00100     myListView = new KDListView(leftWidget, this);
00101     myListView->setVScrollBarMode (QScrollView::AlwaysOff );
00102     connect( myListView, SIGNAL( selectionChanged( QListViewItem* ) ),
00103              this, SLOT( slotSelectionChanged( QListViewItem* ) ) );
00104 
00105     connect( myListView, SIGNAL( mouseButtonClicked ( int, QListViewItem * , const QPoint &, int ) ), this, SLOT( slotmouseButtonClicked ( int , QListViewItem * , const QPoint &, int ) ) );
00106     connect( myListView, SIGNAL( contextMenuRequested ( QListViewItem * , const QPoint &, int  ) ), this, SLOT( slotcontextMenuRequested ( QListViewItem * , const QPoint & , int ) ) );
00107 
00108   connect( myListView, SIGNAL(currentChanged( QListViewItem *  ) ), this, SLOT(slotCurrentChanged ( QListViewItem * ) ) );
00109   connect( myListView, SIGNAL(itemRenamed ( QListViewItem * , int , const QString &  ) ), this, SLOT(slotItemRenamed ( QListViewItem *, int , const QString &  ) ) );
00110   connect( myListView, SIGNAL(mouseButtonPressed(  int, QListViewItem * , const QPoint &, int ) ), this, SLOT(slotMouseButtonPressed (  int , QListViewItem * , const QPoint & , int ) ) );
00111 
00112     //connect( myListView, SIGNAL( ), this, SLOT( ) );
00113     myTimeTable = new KDTimeTableWidget (rightWidget,this);
00114 
00115     spacerRight = new QWidget(  rightWidget );
00116 
00117     myTimeHeaderContainer = new QHBox( rightWidget );
00118     myTimeHeaderContainer->setFrameStyle( QFrame::NoFrame  );
00119     myTimeHeaderContainer->setMargin( 0 );
00120     myTimeHeaderScroll = new QScrollView ( myTimeHeaderContainer );
00121     myTimeHeaderScroll->setHScrollBarMode( QScrollView::AlwaysOff );
00122     myTimeHeaderScroll->setVScrollBarMode( QScrollView::AlwaysOff );
00123     timeHeaderSpacerWidget = new QWidget( myTimeHeaderContainer );
00124 
00125 
00126     /*
00127     myTimeHeaderScroll = new QScrollView ( rightWidget );
00128     myTimeHeaderScroll->setHScrollBarMode( QScrollView::AlwaysOff );
00129     myTimeHeaderScroll->setVScrollBarMode( QScrollView::AlwaysOn );
00130     */
00131     //myTimeHeader = new KDTimeHeaderWidget (rightWidget,this);
00132     myTimeHeader = new KDTimeHeaderWidget (myTimeHeaderScroll->viewport(),this);
00133     myTimeHeaderScroll->addChild( myTimeHeader );
00134     myTimeHeaderScroll->viewport()->setBackgroundColor( myTimeHeader->backgroundColor() );
00135     timeHeaderSpacerWidget->setBackgroundColor( myTimeHeader->backgroundColor() );
00136     myCanvasView = new KDGanttCanvasView (this,myTimeTable,rightWidget);
00137     myTimeHeaderScroll->setFrameStyle( QFrame::NoFrame  );
00138     //
00139     myCanvasView->setFrameStyle( QFrame::NoFrame  );
00140     myCanvasView->setMargin( 0 );
00141     //
00142     myTimeHeaderScroll->setMargin( 0 );//myCanvasView->frameWidth() );
00143     setFrameStyle(myListView->frameStyle());
00144     setLineWidth( 2 );
00145     myListView->setFrameStyle( QFrame::NoFrame  );
00146     myListView->setMargin( 0 );
00147     QObject::connect(myListView, SIGNAL (  expanded ( QListViewItem * ) ) , myTimeTable , SLOT( expandItem(QListViewItem * ))) ;
00148     QObject::connect(myListView, SIGNAL (collapsed ( QListViewItem * ) ) , myTimeTable , SLOT(collapseItem(QListViewItem * ))) ;
00149 
00150     timeHeaderSpacerWidget->setFixedWidth(myCanvasView->verticalScrollBar()->width() );
00151     listViewIsVisible = true;
00152     chartIsEditable = true;
00153     editorIsEnabled = true;
00154     _displaySubitemsAsGroup = false;
00155     initDefaults();
00156     _showHeader = false;
00157 
00158     myTextColor = Qt::black;
00159     myLegendItems = new QPtrList<legendItem>;
00160     //QObject::connect( this, SIGNAL (itemDoubleClicked( KDGanttViewItem* ) ) , this, SLOT( editItem( KDGanttViewItem*  ))) ;
00161     myItemAttributeDialog = new itemAttributeDialog();
00162     setRepaintMode( KDGanttView::Medium );
00163     //setRepaintMode( KDGanttView::Always );
00164     setShowLegendButton( true );
00165     setHeaderVisible( false );
00166 
00167     // now connecting the widgets
00168     connect(myCanvasView->horizontalScrollBar(), SIGNAL (  valueChanged ( int )) ,myTimeHeaderScroll->horizontalScrollBar(), SLOT( setValue ( int))) ;
00169     connect(myCanvasView, SIGNAL (  heightResized( int )) ,myTimeTable, SLOT( checkHeight ( int))) ;
00170     connect(myCanvasView, SIGNAL (  widthResized( int )) ,myTimeHeader, SLOT( checkWidth ( int))) ;
00171 
00172     QObject::connect(myCanvasView->verticalScrollBar(), SIGNAL ( valueChanged ( int ) ) ,myListView->verticalScrollBar(), SLOT( setValue ( int ))) ;
00173     connect(myTimeHeader, SIGNAL ( sizeChanged( int ) ) ,this, SLOT(slotHeaderSizeChanged()  )) ;
00174     connect(myTimeHeader, SIGNAL ( sizeChanged( int ) ) ,myTimeTable, SLOT(resetWidth( int ) )) ;
00175     connect(myListView, SIGNAL ( contentsMoving ( int, int ) ) ,myCanvasView, SLOT(  moveMyContent( int, int ))) ;
00176    connect(myTimeTable, SIGNAL ( heightComputed ( int ) ) ,myCanvasView, SLOT(  setMyContentsHeight( int ))) ;
00177    // the next three are for adding new ticks at left/right
00178     connect( myCanvasView->horizontalScrollBar(), SIGNAL (prevLine () ) ,this, SLOT(addTickLeft()));
00179     connect( myCanvasView->horizontalScrollBar(), SIGNAL (nextLine () ) ,this, SLOT(addTickRight()));
00180     connect( myCanvasView->horizontalScrollBar(), SIGNAL (valueChanged ( int ) ) ,this, SLOT( enableAdding( int )));
00181 
00182    // now initing
00183     fCenterTimeLineAfterShow = false;
00184     fDragEnabled = false;
00185     fDropEnabled = false;
00186     closingBlocked = false;
00187    myTimeHeader->computeTicks();
00188    centerTimelineAfterShow( QDateTime::currentDateTime () );
00189    setDisplayEmptyTasksAsLine( false );
00190    QValueList<int> list;
00191    list.append(240);
00192    list.append(530);
00193    mySplitter->setSizes( list );
00194    myTimeTable->setBlockUpdating();// block updating until this->show() is called
00195 }
00196 
00197 
00198 
00199 KDGanttView::~KDGanttView()
00200 {
00201   setUpdateEnabled(false);
00202   // delete cut item, if there is any
00203   myCanvasView->resetCutPaste( 0 );
00204   myTimeTable->clearTaskLinks();
00205 }
00229 void KDGanttView::setUpdateEnabled( bool enable )
00230 {
00231   myTimeTable->setBlockUpdating( !enable );
00232   if ( enable ) {
00233     myTimeTable->updateMyContent();
00234     myCanvasView->setMyContentsHeight( 0 );
00235   }
00236 }
00237 
00245 bool KDGanttView::getUpdateEnabled() const
00246 {
00247   return !myTimeTable->blockUpdating();
00248 }
00249 
00250 
00251 
00252 
00259 void KDGanttView::setGanttMaximumWidth( int w )
00260 {
00261   myTimeHeader->setMaximumWidth ( w );
00262 }
00270 int  KDGanttView::ganttMaximumWidth() const
00271 {
00272   return myTimeHeader->maximumWidth();
00273 }
00274 
00281 void KDGanttView::show()
00282 {
00283   myTimeTable->setBlockUpdating( false );
00284   if (myCanvasView->horizontalScrollBar()->value() > 0 )
00285     myCanvasView->horizontalScrollBar()->setValue(myCanvasView->horizontalScrollBar()->value()-1  );
00286   else
00287     myCanvasView->horizontalScrollBar()->setValue(1 );
00288   myTimeTable->updateMyContent();
00289   QWidget::show();
00290   myCanvasView->setMyContentsHeight( 0 );
00291   if ( fCenterTimeLineAfterShow ) {
00292     fCenterTimeLineAfterShow = false;
00293     centerTimeline (dtCenterTimeLineAfterShow);
00294   }
00295 }
00303 bool KDGanttView::close ( bool alsoDelete )
00304 {
00305   //qDebug("close ");
00306   if ( closingBlocked )
00307     return false;
00308   return QWidget::close ( alsoDelete );
00309 }
00310 
00311 
00320 QSize KDGanttView::sizeHint() const
00321 {
00322   bool block = myTimeTable->blockUpdating();
00323   myTimeTable->setBlockUpdating( false );
00324   myTimeTable->updateMyContent();
00325   /* The below causes recursive calls to various size updating methods, which
00326    * cause QCanvas to hide and show items like mad, which is very slow. If 
00327    * there is a legitimate gui updating issue here somewhere, it will need
00328    * to be solved differently.
00329    */
00330   //qApp->processEvents();
00331   int hintHeight = myTimeHeader->height();
00332   int legendHeight = 0;
00333   if ( showLegendButton() )
00334     legendHeight = myLegend->height();
00335   int listViewHeaderHeight = 0;
00336   if ( headerVisible() )
00337     listViewHeaderHeight = myListView->header()->height();
00338   if ( hintHeight < legendHeight+listViewHeaderHeight )
00339     hintHeight = legendHeight + listViewHeaderHeight;
00340   hintHeight += myListView->horizontalScrollBar()->height();
00341   if ( myLegend->isShown() )
00342     hintHeight += myLegend->legendSizeHint().height() +10;
00343   hintHeight += myTimeTable->minimumHeight+myListView->frameWidth()*2+2;
00344   int hintWid = myListView->sizeHint().width();
00345   //hintWid += myTimeHeader->mySizeHint+myCanvasView->verticalScrollBar()->width();
00346   hintWid += myCanvasView->sizeHint().width();
00347   // add 10 for the splitter-bars
00348   // qDebug("sizehint %d %d ",hintWid+10, hintHeight );
00349   myTimeTable->setBlockUpdating( block );
00350   return QSize( hintWid+10, hintHeight );
00351 }
00352 
00353 
00361 void KDGanttView::setShowLegendButton( bool show )
00362 {
00363   _showLegendButton = show;
00364      if ( show )
00365          myLegend->show();
00366     else
00367          myLegend->hide();
00368      slotHeaderSizeChanged();
00369 }
00370 
00371 
00378 bool KDGanttView::showLegendButton() const
00379 {
00380     return _showLegendButton;
00381 }
00382 
00383 
00390 void KDGanttView::setHeaderVisible( bool visible )
00391 {
00392     if( visible )
00393         myListView->header()->show();
00394     else
00395         myListView->header()->hide();
00396     _showHeader = visible;
00397     slotHeaderSizeChanged();
00398 }
00399 
00400 
00406 bool KDGanttView::headerVisible() const
00407 {
00408   return _showHeader;
00409 }
00410 
00411 
00420 QDateTime KDGanttView::getDateTimeForCoordX(int coordX, bool global ) const
00421 {
00422   // default for myTimeHeader->getDateTimeForIndex() is local
00423    return myTimeHeader->getDateTimeForIndex(coordX, !global );
00424 }
00425 
00426 
00430 void KDGanttView::slotSelectionChanged( QListViewItem* item )
00431 {
00432     KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00433     Q_ASSERT( gItem );
00434     emit lvSelectionChanged( gItem );
00435 }
00436 
00437 
00438 /*
00439   Implements a casted pass-through of the mouseButtonClicked() signal.
00440   Signals itemLeftClicked() , itemMidClicked() are emitted as well.
00441 */
00442 void KDGanttView::slotmouseButtonClicked ( int button, QListViewItem * item,
00443                                            const QPoint & pos, int c )
00444 {
00445   KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00446   emit lvMouseButtonClicked ( button , gItem,  pos,  c );
00447   if (gItem == 0 && myCurrentItem != 0 ) {
00448     myCurrentItem = 0;
00449     emit lvCurrentChanged( gItem );
00450   }
00451   if (gItem != 0 && myCurrentItem == 0 ) {
00452     myCurrentItem = gItem;
00453     emit lvCurrentChanged( gItem );
00454   }
00455 
00456   // removed - makes no sense!
00457   //emit mouseButtonClicked ( button , gItem,  pos,  c );
00458    {
00459     switch ( button ) {
00460     case  LeftButton:
00461       emit lvItemLeftClicked( gItem );
00462       emit itemLeftClicked( gItem );
00463       break;
00464     case  MidButton:
00465       emit lvItemMidClicked( gItem );
00466       emit itemMidClicked( gItem );
00467       break;
00468     }
00469   }
00470 }
00471 
00472 
00473 /*
00474   Implements a casted pass-through of the contextMenuRequested() signal.
00475   The signal itemRightClicked() is emitted as well;
00476   the position is the global position.
00477 */
00478 void KDGanttView::slotcontextMenuRequested ( QListViewItem * item, const QPoint & pos, int col )
00479 {
00480     KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00481     emit lvContextMenuRequested ( gItem,  pos,  col );
00482     emit lvItemRightClicked( gItem );
00483     emit itemRightClicked( gItem );
00484 }
00485 
00486 
00487 /*
00488   Implements a casted pass-through of the currentChanged() signal.
00489 */
00490 void KDGanttView::slotCurrentChanged ( QListViewItem * item )
00491 {
00492     KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00493     myCurrentItem = gItem;
00494     emit lvCurrentChanged( gItem );
00495 }
00496 
00497 
00498 /*
00499   Implements a casted pass-through of the itemRenamed() signal.
00500 */
00501 void KDGanttView::slotItemRenamed ( QListViewItem * item , int col,
00502                                     const QString & text )
00503 {
00504     KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00505     emit lvItemRenamed( gItem,  col, text );
00506 }
00507 
00508 
00509 /*
00510   Implements a casted pass-through of the mouseButtonPressed() signal.
00511 */
00512 void KDGanttView::slotMouseButtonPressed ( int button, QListViewItem * item,
00513                                            const QPoint & pos, int c )
00514 {
00515     KDGanttViewItem* gItem = static_cast<KDGanttViewItem*>( item );
00516     emit lvMouseButtonPressed( button, gItem,  pos,  c  );
00517 }
00518 
00519 
00534 void KDGanttView::setRepaintMode( RepaintMode mode )
00535 {
00536 
00537   QScrollBar  *cvh, *cvv;
00538   cvh = myCanvasView->horizontalScrollBar();
00539   cvv = myCanvasView->verticalScrollBar();
00540   // first disconnect
00541   cvh->disconnect( this );
00542   cvv->disconnect( this );
00543 
00544   switch ( mode ) {
00545   case  No:
00546 
00547     break;
00548   case Medium:
00549     connect( cvv, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
00550     connect( cvh, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
00551     connect( cvv, SIGNAL (nextLine () ) ,this, SLOT(forceRepaint()));
00552     connect( cvh, SIGNAL (nextLine () ) ,this, SLOT(forceRepaint()));
00553     connect( cvv, SIGNAL (prevLine () ) ,this, SLOT(forceRepaint()));
00554     connect( cvh, SIGNAL (prevLine () ) ,this, SLOT(forceRepaint()));
00555     break;
00556   case Always:
00557     connect( cvv, SIGNAL (valueChanged ( int ) ) ,this, SLOT(forceRepaint( int )));
00558     connect( cvh, SIGNAL (valueChanged ( int ) ) ,this, SLOT(forceRepaint( int )));
00559     connect( cvv, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
00560     connect( cvh, SIGNAL (sliderReleased () ) ,this, SLOT(forceRepaint()));
00561     break;
00562   }
00563 }
00564 
00565 
00566 void KDGanttView::forceRepaint( int )
00567 {
00568   if ( myTimeTable->blockUpdating() )
00569     return;
00570   // qDebug("forceRepaint( int ) ");
00571   myTimeTable->setAllChanged();
00572   myTimeTable->update();
00573 }
00574 
00575 
00576 void KDGanttView::slotHeaderSizeChanged()
00577 {
00578   int legendHeight = 0;
00579   if ( showLegendButton() )
00580     legendHeight = 24;
00581   int listViewHeaderHeight = 0;
00582   if ( headerVisible() )
00583     listViewHeaderHeight = myListView->header()->height();
00584   int timeHeaderHeight = myTimeHeader->height()+myTimeHeaderScroll->frameWidth()*2;;
00585   int diffY = timeHeaderHeight-legendHeight-listViewHeaderHeight;
00586   if ( diffY < 0 ) {
00587     spacerLeft->setFixedHeight( 0 );
00588     spacerRight->setFixedHeight(-diffY);
00589   } else {
00590     spacerRight->setFixedHeight( 0 );
00591     spacerLeft->setFixedHeight( diffY );
00592   }
00593   myLegend->setFixedHeight( legendHeight );
00594   myTimeHeaderContainer->setFixedHeight( timeHeaderHeight );
00595 }
00596 
00597 void KDGanttView::setLegendIsDockwindow( bool show )
00604 {
00605   bool isdock = myLegend->asDockwindow();
00606   if ( show != isdock ) {
00607     myLegend->setAsDockwindow(show);
00608     // legend is cleared - reinit legend with list
00609     legendItem* li;
00610     for ( li = myLegendItems->first(); li; li = myLegendItems->next() ) {
00611       myLegend->addLegendItem(li->shape, li->color, li->text );
00612     }
00613   }
00614 }
00615 
00616 bool KDGanttView::legendIsDockwindow() const
00623 {
00624     return myLegend->asDockwindow();
00625 }
00626 
00627 
00640 QDockWindow* KDGanttView::legendDockwindow() const
00641 {
00642   return myLegend->dockwindow();
00643 }
00644 
00645 
00654 void KDGanttView::setShowLegend( bool show )
00655 {
00656     myLegend->showMe(show);
00657 }
00658 
00659 
00668 bool KDGanttView::showLegend() const
00669 {
00670     return myLegend->isShown();
00671 }
00672 
00673 
00682 void KDGanttView::setShowListView( bool show )
00683 {
00684     if(listViewIsVisible == show) return;
00685     listViewIsVisible = show;
00686     if (listViewIsVisible)
00687         myListView->parentWidget()->show();
00688     else
00689         myListView->parentWidget()->hide();
00690 }
00691 
00692 
00699 bool KDGanttView::showListView() const
00700 {
00701     return listViewIsVisible;
00702 }
00703 
00704 
00714 void KDGanttView::setEditorEnabled( bool enable )
00715 {
00716   editorIsEnabled =  enable;
00717 }
00718 
00719 
00728 bool KDGanttView::editorEnabled() const
00729 {
00730     return editorIsEnabled;
00731 }
00732 
00733 
00742 void KDGanttView::setEditable( bool editable )
00743 {
00744   chartIsEditable =  editable;
00745 }
00746 
00747 
00755 bool KDGanttView::editable() const
00756 {
00757     return chartIsEditable;
00758 }
00759 
00760 
00772 bool KDGanttView::saveProject( QIODevice* device )
00773 {
00774     Q_ASSERT( device );
00775 
00776     QDomDocument doc = saveXML();
00777     if( device->isOpen() )
00778         device->close();
00779     if( device->open( IO_WriteOnly ) ) {
00780         QTextStream ts( device );
00781         ts << doc.toString();
00782         return true;
00783     } else
00784         return false;
00785 }
00786 
00787 
00799 bool KDGanttView::loadProject( QIODevice* device )
00800 {
00801     Q_ASSERT( device );
00802 
00803     if( device->isOpen() )
00804         device->close();
00805     if( device->open( IO_ReadOnly ) ) {
00806         QDomDocument doc( "GanttView" );
00807         QString err;
00808         int errline, errcol;
00809         if ( !doc.setContent( device, &err, &errline, &errcol ) ) {
00810           qDebug("KDGantt::Error parsing XML data at line %d. Message is:", errline );
00811           qDebug("%s ", err.latin1());
00812           device->close();
00813           return false;
00814         }
00815         device->close();
00816         return loadXML( doc );
00817     } else
00818         return false;
00819 }
00820 
00821 
00840 void KDGanttView::print( QPrinter* printer ,
00841                          bool printListView, bool printTimeLine,
00842                          bool printLegend )
00843 {
00844   bool deletePrinter = false;
00845   if (! printer ) {
00846     printer = new QPrinter();
00847     deletePrinter = true;
00848     if ( !printer->setup()) {
00849       delete printer;
00850       return;
00851     }
00852   }
00853   // now we have a printer to print on
00854   QPainter p( printer );
00855   // get the paper metrics
00856   QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer );
00857   float dx, dy;
00858   // get the size of the desired output for scaling.
00859   // here we want to print all: ListView, TimeLine, and Legend
00860   // for this purpose, we call drawContents() with a 0 pointer as painter
00861   QSize size = drawContents( 0, printListView, printTimeLine, printLegend );
00862 
00863   // at the top, we want to print current time/date
00864   QString date = "Printing Time: " + QDateTime::currentDateTime().toString();
00865   int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
00866   p.drawText( 0, 0, date );
00867 
00868   // compute the scale
00869   dx = (float) m.width()  / (float)size.width();
00870   dy  = (float)(m.height() - ( 2 * hei )) / (float)size.height();
00871   float scale;
00872   // scale to fit the width or height of the paper
00873   if ( dx < dy )
00874     scale = dx;
00875   else
00876     scale = dy;
00877   // set the scale
00878   p.scale( scale, scale );
00879   // now printing with y offset:  2 hei
00880   p.translate( 0, 2*hei );
00881   drawContents( &p, printListView, printTimeLine, printLegend );
00882   // the drawContents() has the side effect, that the painter translation is
00883   // after drawContents() set to the bottom of the painted stuff
00884   // for instance a
00885   // p.drawText(0, 0, "printend");
00886   // would be painted directly below the paintout of drawContents()
00887   p.end();
00888   if ( deletePrinter )
00889     delete printer;
00890 }
00891 
00892 
00932 QSize KDGanttView::drawContents( QPainter* p,
00933                       bool drawListView , bool drawTimeLine, bool drawLegend )
00934 {
00935   QSize size;
00936   int lvX, lvY, thX, thY, tlX, tlY, lwX, lwY, allX, allY;
00937   lvX = myListView->contentsWidth();
00938   lvY = myCanvasView->canvas()->height() + 20;
00939   thX = myTimeHeader->width();
00940   thY = myTimeHeader->height();
00941   tlX = myCanvasView->canvas()->width();
00942   tlY = lvY;
00943   lwX = myLegend->legendSize().width();
00944   lwY = myLegend->legendSize().height();
00945   allX = 0;
00946   allY = 0;
00947   if ( drawListView ) {
00948     allX += lvX;
00949     allY += tlY;
00950   }
00951   if ( drawTimeLine ) {
00952     allX += thX;
00953     allY += thY;
00954   }
00955   if ( drawLegend ) {
00956     allY += lwY;
00957     if ( allX < lwX )
00958       allX = lwX ;
00959   }
00960   size = QSize( allX, allY );
00961   int temp = 0;
00962   if ( p ) {
00963     if ( drawListView ) {
00964       if ( drawTimeLine )
00965         temp =  thY;
00966       p->translate( 0, temp );
00967       //HACK: Only draw list headers if we draw timeline, else
00968       // there is no room for it. This will most probably be changed
00969       // with qt4 anyway, so I think we can live with it atm.
00970       myListView->drawToPainter( p, drawTimeLine ); 
00971       p->translate( lvX, -temp);
00972     }
00973     if ( drawTimeLine ) {
00974       p->translate( myCanvasView->frameWidth(), 0);
00975       myTimeHeader->repaintMe( 0, myTimeHeader->width(), p );
00976       p->translate( -myCanvasView->frameWidth(), thY);
00977       myCanvasView->drawToPainter( p );
00978       if ( drawListView )
00979         p->translate( -lvX, tlY);
00980       else
00981         p->translate( 0, tlY);
00982     } else {
00983       if ( drawListView )
00984         p->translate( -lvX, 0 );
00985     }
00986     if ( drawLegend ) {
00987        myLegend->drawToPainter( p );
00988        p->translate( 0, lwY );
00989     }
00990   }
00991   return size;
00992 }
00993 
01007 void KDGanttView::setZoomFactor( double factor, bool absolute )
01008 {
01009     myTimeHeader->zoom(factor,absolute);
01010 }
01011 
01012 
01020 double KDGanttView::zoomFactor() const
01021 {
01022     return myTimeHeader->zoomFactor();
01023 }
01024 
01025 
01034 void KDGanttView::zoomToFit()
01035 {
01036   myTimeHeader->zoomToFit();
01037 }
01038 
01039 
01051 void KDGanttView::zoomToSelection( const QDateTime& start,  const QDateTime&  end )
01052 {
01053 
01054   myTimeHeader->zoomToSelection( start, end);
01055 
01056 }
01057 
01058 
01065 void KDGanttView::ensureVisible( KDGanttViewItem* item )
01066 {
01067     myListView->ensureItemVisible (item);
01068 }
01069 
01070 
01079 void KDGanttView::centerTimeline( const QDateTime& center )
01080 {
01081   myTimeHeader->centerDateTime( center );
01082 }
01083 
01084 
01098 void KDGanttView::centerTimelineAfterShow( const QDateTime& center )
01099 {
01100   myTimeHeader->centerDateTime( center );
01101   if ( ! isVisible() ) {
01102     dtCenterTimeLineAfterShow = center;
01103     fCenterTimeLineAfterShow = true;
01104   }
01105 }
01106 
01111 void KDGanttView::setTimelineToStart()
01112 {
01113   myCanvasView->horizontalScrollBar()->setValue( 0 );
01114 }
01115 
01116 
01120 void KDGanttView::setTimelineToEnd()
01121 {
01122  myCanvasView->horizontalScrollBar()->setValue(myCanvasView->horizontalScrollBar()->maxValue());
01123 }
01124 
01125 
01136 void KDGanttView::addTicksLeft( int num )
01137 {
01138   myTimeHeader->addTickLeft( num  );
01139 }
01140 
01141 
01151 void KDGanttView::addTicksRight( int num )
01152 {
01153   myTimeHeader->addTickRight( num );
01154 }
01155 
01156 
01161 void KDGanttView::center( KDGanttViewItem* item )
01162 {
01163     ensureVisible(item);
01164     int x =  myListView->contentsWidth()/2;
01165     int y = myListView->itemPos (item );
01166     myListView->center(x,y);
01167 }
01168 
01169 
01176 void KDGanttView::setShowTaskLinks( bool show )
01177 {
01178     myTimeTable->setShowTaskLinks(show);
01179 
01180 }
01181 
01182 
01189 bool KDGanttView::showTaskLinks() const
01190 {
01191     return  myTimeTable->showTaskLinks();
01192 }
01193 
01194 
01202 void KDGanttView::setFont(const QFont& font)
01203 {
01204     myListView->setFont(font);
01205     myListView->repaint();
01206     myTimeHeader->setFont(font);
01207     myLegend->setFont( font );
01208     QWidget::setFont( font );
01209     setScale(scale());
01210 }
01211 
01212 
01237 void KDGanttView::setShowHeaderPopupMenu( bool show,
01238                                           bool showZoom,
01239                                           bool showScale,
01240                                           bool showTime,
01241                                           bool showYear,
01242                                           bool showGrid,
01243                                           bool showPrint)
01244 {
01245     myTimeHeader->setShowPopupMenu( show,showZoom,showScale,showTime,
01246                                     showYear,showGrid,showPrint );
01247 }
01248 
01249 
01256 bool KDGanttView::showHeaderPopupMenu() const
01257 {
01258     return myTimeHeader->showPopupMenu();
01259 }
01260 //****************************************************
01261 
01262 
01276 void KDGanttView::setShowTimeTablePopupMenu( bool show )
01277 {
01278     myCanvasView->setShowPopupMenu( show );
01279 }
01280 
01281 
01288 bool KDGanttView::showTimeTablePopupMenu() const
01289 {
01290     return myCanvasView->showPopupMenu();
01291 }
01292 
01293 
01311 void KDGanttView::setShapes( KDGanttViewItem::Type type,
01312                              KDGanttViewItem::Shape start,
01313                              KDGanttViewItem::Shape middle,
01314                              KDGanttViewItem::Shape end,
01315                              bool overwriteExisting )
01316 {
01317     if ( overwriteExisting ) {
01318       QListViewItemIterator it(myListView);
01319       for ( ; it.current(); ++it ) {
01320         if ( ((KDGanttViewItem*)it.current())->type() == type)
01321           ((KDGanttViewItem*)it.current())->setShapes(start,middle, end );
01322       }
01323     }
01324     int index = getIndex( type );
01325     myDefaultShape [index*3] = start;
01326     myDefaultShape [index*3+1] = middle;
01327     myDefaultShape [index*3+2] = end;
01328     undefinedShape[index] = false;
01329 }
01330 
01331 
01344 bool KDGanttView::shapes( KDGanttViewItem::Type type,
01345                           KDGanttViewItem::Shape& start,
01346                           KDGanttViewItem::Shape& middle,
01347                           KDGanttViewItem::Shape& end ) const
01348 {
01349     int index = getIndex( type );
01350     start = myDefaultShape [index*3];
01351     middle = myDefaultShape [index*3+1];
01352     end = myDefaultShape [index*3+2];
01353     return !undefinedShape[index];
01354 }
01355 
01356 
01374 void KDGanttView::setColors( KDGanttViewItem::Type type,
01375                              const QColor& start, const QColor& middle,
01376                              const QColor& end,
01377                              bool overwriteExisting )
01378 {
01379     if ( overwriteExisting ) {
01380       QListViewItemIterator it(myListView);
01381       for ( ; it.current(); ++it ) {
01382         if ( ((KDGanttViewItem*)it.current())->type() == type)
01383           ((KDGanttViewItem*)it.current())->setColors(start,middle, end );
01384       }
01385     }
01386     int index = getIndex( type );
01387     myColor [index*3] = start;
01388     myColor [index*3+1] = middle;
01389     myColor [index*3+2] = end;
01390     undefinedColor[index] = false;
01391 }
01392 
01393 
01406 bool KDGanttView::colors( KDGanttViewItem::Type type,
01407                           QColor& start, QColor& middle, QColor& end ) const
01408 {
01409   int index = getIndex( type );
01410   start = myColor [index*3];
01411     middle = myColor [index*3+1];
01412     end = myColor [index*3+2];
01413     return !undefinedColor[index];
01414 }
01415 
01416 
01436 void KDGanttView::setHighlightColors( KDGanttViewItem::Type type,
01437                                       const QColor& start,
01438                                       const QColor& middle,
01439                                       const QColor& end,
01440                                       bool overwriteExisting )
01441 {
01442     if ( overwriteExisting ) {
01443       QListViewItemIterator it(myListView);
01444       for ( ; it.current(); ++it ) {
01445         if ( ((KDGanttViewItem*)it.current())->type() == type)
01446           ((KDGanttViewItem*)it.current())->setHighlightColors(start,middle, end );
01447       }
01448     }
01449     int index = getIndex( type );
01450     myColorHL [index*3] = start;
01451     myColorHL [index*3+1] = middle;
01452     myColorHL [index*3+2] = end;
01453     undefinedColorHL[index] = false;
01454 
01455 }
01456 
01457 
01472 bool KDGanttView::highlightColors( KDGanttViewItem::Type type,
01473                                    QColor& start, QColor& middle,
01474                                    QColor& end ) const
01475 {
01476   int index = getIndex( type );
01477   start = myColorHL [index*3];
01478     middle = myColorHL [index*3+1];
01479     end = myColorHL [index*3+2];
01480     return !undefinedColorHL[index];
01481 }
01482 
01483 
01491 void KDGanttView::setTextColor( const QColor& color )
01492 {
01493     QListViewItemIterator it(myListView);
01494     for ( ; it.current(); ++it ) {
01495         ((KDGanttViewItem*)it.current())->setTextColor(color);
01496     }
01497     myTextColor = color;
01498 }
01499 
01500 
01507 QColor KDGanttView::textColor() const
01508 {
01509     return myTextColor;
01510 }
01511 
01512 
01523 void KDGanttView::setNoInformationBrush( const QBrush& brush )
01524 {
01525   myTimeTable->setNoInformationBrush( brush );
01526 }
01527 
01528 
01535 QBrush KDGanttView::noInformationBrush() const
01536 {
01537   return myTimeTable->noInformationBrush();
01538 }
01539 
01540 
01546 void KDGanttView::clearLegend( )
01547 {
01548     myLegend->clearLegend();
01549     myLegendItems->setAutoDelete( true );
01550     delete myLegendItems;
01551     myLegendItems = new QPtrList<legendItem>;
01552 }
01553 
01554 
01563 void KDGanttView::addLegendItem( KDGanttViewItem::Shape shape,
01564                                  const QColor& shapeColor,
01565                                  const QString& text )
01566 {
01567     myLegend->addLegendItem( shape,shapeColor,text );
01568     legendItem* item = new legendItem;
01569     item->shape = shape;
01570     item->color = shapeColor;
01571     item->text = text;
01572     myLegendItems->append( item );
01573 }
01574 
01575 
01583 void KDGanttView::setHorizonStart( const QDateTime& start )
01584 {
01585     myTimeHeader->setHorizonStart(start);
01586 }
01587 
01588 
01595 QDateTime KDGanttView::horizonStart() const
01596 {
01597     return myTimeHeader->horizonStart();
01598 }
01599 
01600 
01608 void KDGanttView::setHorizonEnd( const QDateTime& end )
01609 {
01610     myTimeHeader->setHorizonEnd(end);
01611 }
01612 
01613 
01621 QDateTime KDGanttView::horizonEnd() const
01622 {
01623     return myTimeHeader->horizonEnd();
01624 }
01625 
01626 
01634 void KDGanttView::setScale( Scale unit )
01635 {
01636     myTimeHeader->setScale( unit );
01637 }
01638 
01639 
01646 KDGanttView::Scale KDGanttView::scale() const
01647 {
01648     return myTimeHeader->scale();
01649 }
01650 
01651 
01658 void KDGanttView::setMaximumScale( Scale unit )
01659 {
01660     myTimeHeader->setMaximumScale( unit );
01661 }
01662 
01663 
01670 KDGanttView::Scale KDGanttView::maximumScale() const
01671 {
01672     return myTimeHeader->maximumScale();
01673 }
01674 
01675 
01682 void KDGanttView::setMinimumScale( Scale unit )
01683 {
01684     myTimeHeader->setMinimumScale( unit );
01685 }
01686 
01687 
01694 KDGanttView::Scale KDGanttView::minimumScale() const
01695 {
01696     return myTimeHeader->minimumScale();
01697 }
01698 
01699 
01709 void KDGanttView::setAutoScaleMinorTickCount( int count )
01710 {
01711   myTimeHeader->setAutoScaleMinorTickCount( count );
01712 }
01713 
01714 
01721 int KDGanttView::autoScaleMinorTickCount() const
01722 {
01723   return myTimeHeader->autoScaleMinorTickCount();
01724 }
01725 
01726 
01735 void KDGanttView::setMinimumColumnWidth( int width )
01736 {
01737     myTimeHeader->setMinimumColumnWidth( width );
01738 }
01739 
01740 
01747 int KDGanttView::minimumColumnWidth() const
01748 {
01749     return myTimeHeader->minimumColumnWidth();
01750 }
01751 
01752 
01760 void KDGanttView::setYearFormat( YearFormat format )
01761 {
01762     myTimeHeader->setYearFormat(format );
01763 }
01764 
01765 
01772 KDGanttView::YearFormat KDGanttView::yearFormat() const
01773 {
01774     return myTimeHeader->yearFormat();
01775 }
01776 
01777 
01786 void KDGanttView::setHourFormat( HourFormat format )
01787 {
01788     myTimeHeader->setHourFormat( format );
01789 }
01790 
01791 
01799 KDGanttView::HourFormat KDGanttView::hourFormat() const
01800 {
01801     return myTimeHeader->hourFormat();
01802 }
01803 
01804 
01815 void KDGanttView::setShowMajorTicks( bool show )
01816 {
01817     myTimeHeader->setShowMajorTicks(show );
01818 }
01819 
01820 
01827 bool KDGanttView::showMajorTicks() const
01828 {
01829     return myTimeHeader->showMajorTicks();
01830 }
01831 
01832 
01845 void KDGanttView::setShowMinorTicks( bool show)
01846 {
01847     myTimeHeader->setShowMinorTicks( show );
01848 }
01849 
01850 
01857 bool KDGanttView::showMinorTicks() const
01858 {
01859     return myTimeHeader->showMinorTicks();
01860 }
01861 
01862 
01880 void KDGanttView::setColumnBackgroundColor( const QDateTime& column,
01881                                             const QColor& color ,
01882                                             Scale mini, Scale maxi )
01883 {
01884   myTimeHeader->setColumnBackgroundColor( column, color,mini,maxi );
01885 }
01886 
01887 
01914 void KDGanttView::setIntervalBackgroundColor( const QDateTime& start,
01915                                               const QDateTime& end,
01916                                               const QColor& color ,
01917                                               Scale mini, Scale maxi )
01918 {
01919   myTimeHeader->setIntervalBackgroundColor( start, end, color,mini,maxi );
01920 }
01921 
01922 
01941 bool KDGanttView::changeBackgroundInterval( const QDateTime& oldstart,
01942                                    const QDateTime& oldend,
01943                                    const QDateTime& newstart,
01944                                    const QDateTime& newend )
01945 {
01946   return myTimeHeader->changeBackgroundInterval( oldstart, oldend,
01947                                                  newstart, newend );
01948 }
01949 
01959 bool KDGanttView::deleteBackgroundInterval( const QDateTime& start,
01960                                             const QDateTime& end)
01961 {
01962   return myTimeHeader->deleteBackgroundInterval( start, end );
01963 }
01964 
01965 
01974 void KDGanttView::clearBackgroundColor()
01975 {
01976   myTimeHeader->clearBackgroundColor();
01977 }
01978 
01979 
01988 QColor KDGanttView::columnBackgroundColor( const QDateTime& column ) const
01989 {
01990     return myTimeHeader->columnBackgroundColor( column ) ;
01991 }
01992 
01993 
02002 void KDGanttView::setWeekendBackgroundColor( const QColor& color )
02003 {
02004     myTimeHeader->setWeekendBackgroundColor( color );
02005 }
02006 
02007 
02014 QColor KDGanttView::weekendBackgroundColor() const
02015 {
02016     return myTimeHeader->weekendBackgroundColor();
02017 }
02018 
02019 
02030 void KDGanttView::setWeekdayBackgroundColor( const QColor& color, int  weekday )
02031 {
02032   myTimeHeader->setWeekdayBackgroundColor( color,  weekday );
02033 }
02034 
02035 
02043 QColor KDGanttView::weekdayBackgroundColor(int weekday) const
02044 {
02045   return myTimeHeader->weekdayBackgroundColor( weekday);
02046 }
02047 
02048 
02049 
02060 void KDGanttView::setWeekendDays( int start, int end )
02061 {
02062     myTimeHeader->setWeekendDays( start,  end );
02063 }
02064 
02065 
02073 void KDGanttView::weekendDays( int& start, int& end ) const
02074 {
02075     myTimeHeader->weekendDays( start,  end );
02076 }
02077 
02078 
02179 void KDGanttView::setMajorScaleCount( int count )
02180 {
02181     myTimeHeader->setMajorScaleCount(count );
02182 }
02183 
02184 
02191 int KDGanttView::majorScaleCount() const
02192 {
02193     return myTimeHeader->majorScaleCount();
02194 }
02195 
02196 
02203 void KDGanttView::setMinorScaleCount( int count )
02204 {
02205     myTimeHeader->setMinorScaleCount(count );
02206 }
02207 
02208 
02215 int KDGanttView::minorScaleCount() const
02216 {
02217     return myTimeHeader->minorScaleCount();
02218 
02219 }
02220 
02221 
02234 void KDGanttView::setDefaultColor( KDGanttViewItem::Type type,
02235                                    const QColor& color,
02236                                    bool overwriteExisting )
02237 {
02238     if ( overwriteExisting ) {
02239       QListViewItemIterator it(myListView);
02240       for ( ; it.current(); ++it ) {
02241         if ( ((KDGanttViewItem*)it.current())->type() == type)
02242           ((KDGanttViewItem*)it.current())->setDefaultColor(color );
02243       }
02244     }
02245     int index = getIndex( type );
02246     myDefaultColor [index] = color;
02247 }
02248 
02249 
02250 
02261 QColor KDGanttView::defaultColor( KDGanttViewItem::Type type ) const
02262 {
02263   int index = getIndex( type );
02264   return myDefaultColor [index];
02265 }
02266 
02267 
02280 void KDGanttView::setDefaultHighlightColor( KDGanttViewItem::Type type,
02281                                             const QColor& color,
02282                                             bool overwriteExisting )
02283 {
02284     if ( overwriteExisting ) {
02285       QListViewItemIterator it(myListView);
02286       for ( ; it.current(); ++it ) {
02287         if ( ((KDGanttViewItem*)it.current())->type() == type)
02288           ((KDGanttViewItem*)it.current())->setDefaultHighlightColor(color );
02289       }
02290     }
02291     int index = getIndex( type );
02292     myDefaultColorHL [index] = color;
02293 }
02294 
02295 
02296 
02307 QColor KDGanttView::defaultHighlightColor( KDGanttViewItem::Type type ) const
02308 {
02309   int index = getIndex( type );
02310   return myDefaultColorHL [index];
02311 }
02312 
02313 
02319 KDGanttViewItem* KDGanttView::firstChild() const
02320 {
02321     return (KDGanttViewItem*)myListView->firstChild();
02322 
02323 }
02341 void KDGanttView::setCalendarMode( bool mode )
02342 {
02343   myListView->setCalendarMode( mode );
02344 }
02345 
02346 
02354 bool  KDGanttView::calendarMode() const
02355 {
02356   return  myListView->calendarMode();
02357 }
02358 
02359 
02360 
02370 void KDGanttView::setDisplaySubitemsAsGroup( bool show )
02371 {
02372  QListViewItemIterator it( myListView );
02373  for ( ; it.current(); ++it ) {
02374    KDGanttViewItem* currentItem = ( KDGanttViewItem* )it.current();
02375    currentItem->setDisplaySubitemsAsGroup( show );
02376  }
02377  _displaySubitemsAsGroup = show;
02378 }
02379 
02380 
02389 bool KDGanttView::displaySubitemsAsGroup() const
02390 {
02391   return _displaySubitemsAsGroup;
02392 }
02393 
02394 
02402 void KDGanttView::setDisplayEmptyTasksAsLine( bool show )
02403 {
02404   _displayEmptyTasksAsLine = show;
02405 }
02406 
02407 
02414 bool KDGanttView::displayEmptyTasksAsLine() const
02415 {
02416   return _displayEmptyTasksAsLine;
02417 }
02418 
02419 
02434 void KDGanttView::setHorBackgroundLines( int count, QBrush brush )
02435 {
02436   myTimeTable->setHorBackgroundLines(  count, brush );
02437 }
02438 
02439 
02449 int KDGanttView::horBackgroundLines( QBrush& brush )
02450 {
02451   return myTimeTable->horBackgroundLines( brush );
02452 }
02453 
02454 
02460 KDGanttViewItem* KDGanttView::lastItem() const
02461 {
02462     return (KDGanttViewItem*)myListView->lastItem ();
02463 }
02464 
02465 
02471 QPtrList<KDGanttViewTaskLink> KDGanttView::taskLinks() const
02472 {
02473 
02474     return myTimeTable->taskLinks();
02475 }
02476 
02477 
02483 QPtrList<KDGanttViewTaskLinkGroup> KDGanttView::taskLinkGroups() const
02484 {
02485     return myTaskLinkGroupList;
02486 }
02487 
02488 
02496 bool KDGanttView::loadXML( const QDomDocument& doc )
02497 {
02498     QDomElement docRoot = doc.documentElement(); // ChartParams element
02499     QDomNode node = docRoot.firstChild();
02500     while( !node.isNull() ) {
02501         QDomElement element = node.toElement();
02502         if( !element.isNull() ) { // was really an element
02503             QString tagName = element.tagName();
02504             if( tagName == "ShowLegend" ) {
02505                 bool value;
02506                 if( KDGanttXML::readBoolNode( element, value ) )
02507                     setShowLegend( value );
02508             } else if( tagName == "ShowLegendButton" ) {
02509                 bool value;
02510                 if( KDGanttXML::readBoolNode( element, value ) )
02511                     setShowLegendButton( value );
02512             } else if( tagName == "LegendIsDockWindow" ) {
02513                 bool value;
02514                 if( KDGanttXML::readBoolNode( element, value ) )
02515                     setLegendIsDockwindow( value );
02516             } else if( tagName == "ShowListView" ) {
02517                 bool value;
02518                 if( KDGanttXML::readBoolNode( element, value ) )
02519                     setShowListView( value );
02520             } else if( tagName == "ShowHeader" ) {
02521               bool value;
02522               if( KDGanttXML::readBoolNode( element, value ) )
02523                 setHeaderVisible( value );
02524             } else if( tagName == "ShowTaskLinks" ) {
02525                 bool value;
02526                 if( KDGanttXML::readBoolNode( element, value ) )
02527                     setShowTaskLinks( value );
02528             } else if( tagName == "EditorEnabled" ) {
02529                 bool value;
02530                 if( KDGanttXML::readBoolNode( element, value ) )
02531                     setEditorEnabled( value );
02532             } else if( tagName == "DisplayEmptyTasksAsLine" ) {
02533               bool value;
02534               if( KDGanttXML::readBoolNode( element, value ) )
02535                 setDisplayEmptyTasksAsLine( value );
02536             } else if( tagName == "GlobalFont" ) {
02537                 QFont font;
02538                 if( KDGanttXML::readFontNode( element, font ) )
02539                     setFont( font );
02540             } else if( tagName == "HorizonStart" ) {
02541                 QDateTime value;
02542                 if( KDGanttXML::readDateTimeNode( element, value ) )
02543                     setHorizonStart( value );
02544             } else if( tagName == "HorizonEnd" ) {
02545                 QDateTime value;
02546                 if( KDGanttXML::readDateTimeNode( element, value ) )
02547                     setHorizonEnd( value );
02548             } else if( tagName == "Scale" ) {
02549                 QString value;
02550                 if( KDGanttXML::readStringNode( element, value ) )
02551                     setScale( stringToScale( value ) );
02552             } else if( tagName == "MinimumScale" ) {
02553                 QString value;
02554                 if( KDGanttXML::readStringNode( element, value ) )
02555                     setMinimumScale( stringToScale( value ) );
02556             } else if( tagName == "MaximumScale" ) {
02557                 QString value;
02558                 if( KDGanttXML::readStringNode( element, value ) )
02559                     setMaximumScale( stringToScale( value ) );
02560             } else if( tagName == "YearFormat" ) {
02561                 QString value;
02562                 if( KDGanttXML::readStringNode( element, value ) )
02563                     setYearFormat( stringToYearFormat( value ) );
02564             } else if( tagName == "HourFormat" ) {
02565                 QString value;
02566                 if( KDGanttXML::readStringNode( element, value ) )
02567                     setHourFormat( stringToHourFormat( value ) );
02568             } else if( tagName == "ShowMinorTicks" ) {
02569                 bool value;
02570                 if( KDGanttXML::readBoolNode( element, value ) )
02571                     setShowMinorTicks( value );
02572             } else if( tagName == "ShowMajorTicks" ) {
02573                 bool value;
02574                 if( KDGanttXML::readBoolNode( element, value ) )
02575                     setShowMajorTicks( value );
02576             } else if( tagName == "DragEnabled" ) {
02577                 bool value;
02578                 if( KDGanttXML::readBoolNode( element, value ) )
02579                     setDragEnabled( value );
02580             } else if( tagName == "DropEnabled" ) {
02581                 bool value;
02582                 if( KDGanttXML::readBoolNode( element, value ) )
02583                     setDropEnabled( value );
02584             } else if( tagName == "CalendarMode" ) {
02585                 bool value;
02586                 if( KDGanttXML::readBoolNode( element, value ) )
02587                     setCalendarMode( value );
02588             } else if( tagName == "Editable" ) {
02589                 bool value;
02590                 if( KDGanttXML::readBoolNode( element, value ) )
02591                     setEditable( value );
02592             } else if( tagName == "TextColor" ) {
02593                 QColor value;
02594                 if( KDGanttXML::readColorNode( element, value ) )
02595                     setTextColor( value );
02596             } else if( tagName == "MajorScaleCount" ) {
02597                 int value;
02598                 if( KDGanttXML::readIntNode( element, value ) )
02599                     setMajorScaleCount( value );
02600             } else if( tagName == "MinorScaleCount" ) {
02601                 int value;
02602                 if( KDGanttXML::readIntNode( element, value ) )
02603                     setMinorScaleCount( value );
02604             } else if( tagName == "AutoScaleMinorTickCount" ) {
02605                 int value;
02606                 if( KDGanttXML::readIntNode( element, value ) )
02607                     setAutoScaleMinorTickCount( value );
02608             } else if( tagName == "MinimumColumnWidth" ) {
02609                 int value;
02610                 if( KDGanttXML::readIntNode( element, value ) )
02611                     setMinimumColumnWidth( value );
02612             } else if( tagName == "GanttMaximumWidth" ) {
02613                 int value;
02614                 if( KDGanttXML::readIntNode( element, value ) )
02615                     setGanttMaximumWidth( value );
02616             } else if( tagName == "NoInformationBrush" ) {
02617               QBrush value;
02618               if( KDGanttXML::readBrushNode( element, value ) )
02619                 setNoInformationBrush( value );
02620             } else if( tagName == "GanttViewBackgroundColor" ) {
02621                 QColor value;
02622                 if( KDGanttXML::readColorNode( element, value ) )
02623                     setGvBackgroundColor( value );
02624             } else if( tagName == "ListViewBackgroundColor" ) {
02625                 QColor value;
02626                 if( KDGanttXML::readColorNode( element, value ) )
02627                     setLvBackgroundColor( value );
02628             } else if( tagName == "TimeHeaderBackgroundColor" ) {
02629                 QColor value;
02630                 if( KDGanttXML::readColorNode( element, value ) )
02631                     setTimeHeaderBackgroundColor( value );
02632             } else if( tagName == "LegendHeaderBackgroundColor" ) {
02633                 QColor value;
02634                 if( KDGanttXML::readColorNode( element, value ) )
02635                     setLegendHeaderBackgroundColor( value );
02636             } else if( tagName == "WeekendBackgroundColor" ) {
02637                 QColor value;
02638                 if( KDGanttXML::readColorNode( element, value ) )
02639                     setWeekendBackgroundColor( value );
02640             } else if( tagName == "WeekdayBackgroundColor" ) {
02641                 QDomNode node = element.firstChild();
02642                 int day = 0;
02643                 QColor color;
02644                 while( !node.isNull() ) {
02645                     QDomElement element = node.toElement();
02646                     if( !element.isNull() ) { // was really an elemente
02647                         QString tagName = element.tagName();
02648                         if( tagName == "Day" ) {
02649                             int value;
02650                             if( KDGanttXML::readIntNode( element, value ) )
02651                                 day = value;
02652                         } else if( tagName == "Color" ) {
02653                             QColor value;
02654                             if( KDGanttXML::readColorNode( element, value ) )
02655                                 color = value;
02656                         } else {
02657                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02658                             Q_ASSERT( false );
02659                         }
02660                     }
02661                     node = node.nextSibling();
02662                 }
02663 
02664                 if( day && color.isValid() )
02665                     setWeekdayBackgroundColor( color, day );
02666             } else if( tagName == "WeekendDays" ) {
02667                 QString startString = element.attribute( "Start" );
02668                 QString endString = element.attribute( "End" );
02669                 bool startOk = false, endOk = false;
02670                 int start = startString.toInt( &startOk );
02671                 int end = startString.toInt( &endOk );
02672                 if( startOk && endOk )
02673                     setWeekendDays( start, end );
02674             } else if( tagName == "ZoomFactor" ) {
02675                 double value;
02676                 if( KDGanttXML::readDoubleNode( element, value ) )
02677                     setZoomFactor( value, true );
02678             } else if( tagName == "ShowHeaderPopupMenu" ) {
02679                 bool value;
02680                 if( KDGanttXML::readBoolNode( element, value ) )
02681                     setShowHeaderPopupMenu( value );
02682             } else if( tagName == "ShowTimeTablePopupMenu" ) {
02683                 bool value;
02684                 if( KDGanttXML::readBoolNode( element, value ) )
02685                     setShowTimeTablePopupMenu( value );
02686             } else if( tagName == "Shapes" ) {
02687                 QDomNode node = element.firstChild();
02688                 bool undefinedShape = false;
02689                 while( !node.isNull() ) {
02690                     QDomElement element = node.toElement();
02691                     if( !element.isNull() ) { // was really an elemente
02692                         QString tagName = element.tagName();
02693                         if( tagName == "Event" ) {
02694                             KDGanttViewItem::Shape startShape, middleShape, endShape;
02695                             startShape = KDGanttViewItem::TriangleDown;
02696                             middleShape = KDGanttViewItem::TriangleDown;
02697                             endShape = KDGanttViewItem::TriangleDown;
02698                             QDomNode node = element.firstChild();
02699                             while( !node.isNull() ) {
02700                                 QDomElement element = node.toElement();
02701                                 if( !element.isNull() ) { // was really an elemente
02702                                     QString tagName = element.tagName();
02703                                     if( tagName == "Start" ) {
02704                                         QString value;
02705                                         if( KDGanttXML::readStringNode( element, value ) )
02706                                             startShape = KDGanttViewItem::stringToShape( value );
02707                                         if ( value == "Undefined" )
02708                                           undefinedShape = true;
02709                                     } else if( tagName == "Middle" ) {
02710                                         QString value;
02711                                         if( KDGanttXML::readStringNode( element, value ) )
02712                                             middleShape = KDGanttViewItem::stringToShape( value );
02713                                         if ( value == "Undefined" )
02714                                           undefinedShape = true;
02715                                     } else if( tagName == "End" ) {
02716                                         QString value;
02717                                         if( KDGanttXML::readStringNode( element, value ) )
02718                                             endShape = KDGanttViewItem::stringToShape( value );
02719                                         if ( value == "Undefined" )
02720                                           undefinedShape = true;
02721                                     } else {
02722                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02723                                         Q_ASSERT( false );
02724                                     }
02725                                 }
02726                                 node = node.nextSibling();
02727                             }
02728                             if ( ! undefinedShape )
02729                               setShapes( KDGanttViewItem::Event, startShape,
02730                                        middleShape, endShape, false );
02731                             undefinedShape = false;
02732                         } else if( tagName == "Task" ) {
02733                             KDGanttViewItem::Shape startShape, middleShape, endShape;
02734                             startShape = KDGanttViewItem::TriangleDown;
02735                             middleShape = KDGanttViewItem::TriangleDown;
02736                             endShape = KDGanttViewItem::TriangleDown;
02737                             QDomNode node = element.firstChild();
02738                             while( !node.isNull()) {
02739                                 QDomElement element = node.toElement();
02740                                 if( !element.isNull() ) { // was really an elemente
02741                                     QString tagName = element.tagName();
02742                                     if( tagName == "Start" ) {
02743                                         QString value;
02744                                         if( KDGanttXML::readStringNode( element, value ) )
02745                                             startShape = KDGanttViewItem::stringToShape( value );
02746                                         if ( value == "Undefined" )
02747                                           undefinedShape = true;
02748                                     } else if( tagName == "Middle" ) {
02749                                         QString value;
02750                                         if( KDGanttXML::readStringNode( element, value ) )
02751                                             middleShape = KDGanttViewItem::stringToShape( value );
02752                                         if ( value == "Undefined" )
02753                                           undefinedShape = true;
02754                                     } else if( tagName == "End" ) {
02755                                         QString value;
02756                                         if( KDGanttXML::readStringNode( element, value ) )
02757                                             endShape = KDGanttViewItem::stringToShape( value );
02758                                         if ( value == "Undefined" )
02759                                           undefinedShape = true;
02760                                     } else {
02761                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02762                                         Q_ASSERT( false );
02763                                     }
02764                                 }
02765                                 node = node.nextSibling();
02766                             }
02767                             if ( ! undefinedShape )
02768                               setShapes( KDGanttViewItem::Task, startShape, middleShape, endShape, false );
02769                             undefinedShape = false;
02770                         } else if( tagName == "Summary" ) {
02771                             KDGanttViewItem::Shape startShape, middleShape, endShape;
02772                             startShape = KDGanttViewItem::TriangleDown;
02773                             middleShape = KDGanttViewItem::TriangleDown;
02774                             endShape = KDGanttViewItem::TriangleDown;
02775                             QDomNode node = element.firstChild();
02776                             while( !node.isNull() ) {
02777                                 QDomElement element = node.toElement();
02778                                 if( !element.isNull() ) { // was really an elemente
02779                                     QString tagName = element.tagName();
02780                                     if( tagName == "Start" ) {
02781                                         QString value;
02782                                         if( KDGanttXML::readStringNode( element, value ) )
02783                                             startShape = KDGanttViewItem::stringToShape( value );
02784                                         if ( value == "Undefined" )
02785                                           undefinedShape = true;
02786                                     } else if( tagName == "Middle" ) {
02787                                         QString value;
02788                                         if( KDGanttXML::readStringNode( element, value ) )
02789                                             middleShape = KDGanttViewItem::stringToShape( value );
02790                                         if ( value == "Undefined" )
02791                                           undefinedShape = true;
02792                                     } else if( tagName == "End" ) {
02793                                         QString value;
02794                                         if( KDGanttXML::readStringNode( element, value ) )
02795                                             endShape = KDGanttViewItem::stringToShape( value );
02796                                         if ( value == "Undefined" )
02797                                           undefinedShape = true;
02798                                     } else {
02799                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02800                                         Q_ASSERT( false );
02801                                     }
02802                                 }
02803                                 node = node.nextSibling();
02804                             }
02805                             if ( ! undefinedShape )
02806                               setShapes( KDGanttViewItem::Summary, startShape,
02807                                        middleShape, endShape, false );
02808                             undefinedShape = false;
02809                         } else {
02810                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02811                             Q_ASSERT( false );
02812                         }
02813                     }
02814                     node = node.nextSibling();
02815                 }
02816             } else if( tagName == "Colors" ) {
02817                 QDomNode node = element.firstChild();
02818                 while( !node.isNull()) {
02819                     QDomElement element = node.toElement();
02820                     if( !element.isNull() ) { // was really an elemente
02821                         QString tagName = element.tagName();
02822                         if( tagName == "Event" ) {
02823                             QColor startColor, middleColor, endColor;
02824                             QDomNode node = element.firstChild();
02825                             while( !node.isNull() ) {
02826                                 QDomElement element = node.toElement();
02827                                 if( !element.isNull() ) { // was really an elemente
02828                                     QString tagName = element.tagName();
02829                                     if( tagName == "Start" ) {
02830                                         QColor value;
02831                                         if( KDGanttXML::readColorNode( element, value ) )
02832                                             startColor = value;
02833                                     } else if( tagName == "Middle" ) {
02834                                         QColor value;
02835                                         if( KDGanttXML::readColorNode( element, value ) )
02836                                             middleColor = value;
02837                                     } else if( tagName == "End" ) {
02838                                         QColor value;
02839                                         if( KDGanttXML::readColorNode( element, value ) )
02840                                             endColor = value;
02841                                     } else {
02842                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02843                                         Q_ASSERT( false );
02844                                     }
02845                                 }
02846                                 node = node.nextSibling();
02847                             }
02848                             setColors( KDGanttViewItem::Event, startColor,
02849                                        middleColor, endColor, false );
02850                         } else if( tagName == "Task" ) {
02851                             QColor startColor, middleColor, endColor;
02852                             QDomNode node = element.firstChild();
02853                             while( !node.isNull() ) {
02854                                 QDomElement element = node.toElement();
02855                                 if( !element.isNull() ) { // was really an elemente
02856                                     QString tagName = element.tagName();
02857                                     if( tagName == "Start" ) {
02858                                         QColor value;
02859                                         if( KDGanttXML::readColorNode( element, value ) )
02860                                             startColor = value;
02861                                     } else if( tagName == "Middle" ) {
02862                                         QColor value;
02863                                         if( KDGanttXML::readColorNode( element, value ) )
02864                                             middleColor = value;
02865                                     } else if( tagName == "End" ) {
02866                                         QColor value;
02867                                         if( KDGanttXML::readColorNode( element, value ) )
02868                                             endColor = value;
02869                                     } else {
02870                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02871                                         Q_ASSERT( false );
02872                                     }
02873                                 }
02874                                 node = node.nextSibling();
02875                             }
02876                             setColors( KDGanttViewItem::Task, startColor,
02877                                        middleColor, endColor, false );
02878                         } else if( tagName == "Summary" ) {
02879                             QColor startColor, middleColor, endColor;
02880                             QDomNode node = element.firstChild();
02881                             while( !node.isNull() ) {
02882                                 QDomElement element = node.toElement();
02883                                 if( !element.isNull() ) { // was really an elemente
02884                                     QString tagName = element.tagName();
02885                                     if( tagName == "Start" ) {
02886                                         QColor value;
02887                                         if( KDGanttXML::readColorNode( element, value ) )
02888                                             startColor = value;
02889                                     } else if( tagName == "Middle" ) {
02890                                         QColor value;
02891                                         if( KDGanttXML::readColorNode( element, value ) )
02892                                             middleColor = value;
02893                                     } else if( tagName == "End" ) {
02894                                         QColor value;
02895                                         if( KDGanttXML::readColorNode( element, value ) )
02896                                             endColor = value;
02897                                     } else {
02898                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02899                                         Q_ASSERT( false );
02900                                     }
02901                                 }
02902                                 node = node.nextSibling();
02903                             }
02904                             setColors( KDGanttViewItem::Summary, startColor,
02905                                        middleColor, endColor , false);
02906                         } else {
02907                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02908                             Q_ASSERT( false );
02909                         }
02910                     }
02911                     node = node.nextSibling();
02912                 }
02913             } else if( tagName == "DefaultColors" ) {
02914                 QDomNode node = element.firstChild();
02915                 while( !node.isNull() ) {
02916                     QDomElement element = node.toElement();
02917                     if( !element.isNull() ) { // was really an element
02918                         QString tagName = element.tagName();
02919                         if( tagName == "Event" ) {
02920                             QColor value;
02921                             if( KDGanttXML::readColorNode( element, value ) )
02922                                 setDefaultColor( KDGanttViewItem::Event,
02923                                                  value, false );
02924                         } else if( tagName == "Task" ) {
02925                             QColor value;
02926                             if( KDGanttXML::readColorNode( element, value ) )
02927                                 setDefaultColor( KDGanttViewItem::Task,
02928                                                  value, false );
02929                         } else if( tagName == "Summary" ) {
02930                             QColor value;
02931                             if( KDGanttXML::readColorNode( element, value ) )
02932                                 setDefaultColor( KDGanttViewItem::Summary,
02933                                                  value , false);
02934                         } else {
02935                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02936                             Q_ASSERT( false );
02937                         }
02938                     }
02939 
02940                     node = node.nextSibling();
02941                 }
02942             } else if( tagName == "HighlightColors" ) {
02943                 QDomNode node = element.firstChild();
02944                 while( !node.isNull() ) {
02945                     QDomElement element = node.toElement();
02946                     if( !element.isNull() ) { // was really an elemente
02947                         QString tagName = element.tagName();
02948                         if( tagName == "Event" ) {
02949                             QColor startColor, middleColor, endColor;
02950                             QDomNode node = element.firstChild();
02951                             while( !node.isNull() ) {
02952                                 QDomElement element = node.toElement();
02953                                 if( !element.isNull() ) { // was really an elemente
02954                                     QString tagName = element.tagName();
02955                                     if( tagName == "Start" ) {
02956                                         QColor value;
02957                                         if( KDGanttXML::readColorNode( element, value ) )
02958                                             startColor = value;
02959                                     } else if( tagName == "Middle" ) {
02960                                         QColor value;
02961                                         if( KDGanttXML::readColorNode( element, value ) )
02962                                             middleColor = value;
02963                                     } else if( tagName == "End" ) {
02964                                         QColor value;
02965                                         if( KDGanttXML::readColorNode( element, value ) )
02966                                             endColor = value;
02967                                     } else {
02968                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02969                                         Q_ASSERT( false );
02970                                     }
02971                                 }
02972                                 node = node.nextSibling();
02973                             }
02974                             setHighlightColors( KDGanttViewItem::Event,
02975                                                 startColor,
02976                                                 middleColor, endColor, false );
02977                         } else if( tagName == "Task" ) {
02978                             QColor startColor, middleColor, endColor;
02979                             QDomNode node = element.firstChild();
02980                             while( !node.isNull() ) {
02981                                 QDomElement element = node.toElement();
02982                                 if( !element.isNull() ) { // was really an elemente
02983                                     QString tagName = element.tagName();
02984                                     if( tagName == "Start" ) {
02985                                         QColor value;
02986                                         if( KDGanttXML::readColorNode( element, value ) )
02987                                             startColor = value;
02988                                     } else if( tagName == "Middle" ) {
02989                                         QColor value;
02990                                         if( KDGanttXML::readColorNode( element, value ) )
02991                                             middleColor = value;
02992                                     } else if( tagName == "End" ) {
02993                                         QColor value;
02994                                         if( KDGanttXML::readColorNode( element, value ) )
02995                                             endColor = value;
02996                                     } else {
02997                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
02998                                         Q_ASSERT( false );
02999                                     }
03000                                 }
03001                                 node = node.nextSibling();
03002                             }
03003                             setHighlightColors( KDGanttViewItem::Task,
03004                                                 startColor,
03005                                                 middleColor, endColor , false);
03006                         } else if( tagName == "Summary" ) {
03007                             QColor startColor, middleColor, endColor;
03008                             QDomNode node = element.firstChild();
03009                             while( !node.isNull() ) {
03010                                 QDomElement element = node.toElement();
03011                                 if( !element.isNull() ) { // was really an elemente
03012                                     QString tagName = element.tagName();
03013                                     if( tagName == "Start" ) {
03014                                         QColor value;
03015                                         if( KDGanttXML::readColorNode( element, value ) )
03016                                             startColor = value;
03017                                     } else if( tagName == "Middle" ) {
03018                                         QColor value;
03019                                         if( KDGanttXML::readColorNode( element, value ) )
03020                                             middleColor = value;
03021                                     } else if( tagName == "End" ) {
03022                                         QColor value;
03023                                         if( KDGanttXML::readColorNode( element, value ) )
03024                                             endColor = value;
03025                                     } else {
03026                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03027                                         Q_ASSERT( false );
03028                                     }
03029                                 }
03030                                 node = node.nextSibling();
03031                             }
03032                             setHighlightColors( KDGanttViewItem::Summary,
03033                                                 startColor,
03034                                                 middleColor, endColor, false );
03035                         } else {
03036                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03037                             Q_ASSERT( false );
03038                         }
03039                     }
03040                     node = node.nextSibling();
03041                 }
03042             } else if( tagName == "DefaultHighlightColors" ) {
03043                 QDomNode node = element.firstChild();
03044                 while( !node.isNull() ) {
03045                     QDomElement element = node.toElement();
03046                     if( !element.isNull() ) { // was really an element
03047                         QString tagName = element.tagName();
03048                         if( tagName == "Event" ) {
03049                             QColor value;
03050                             if( KDGanttXML::readColorNode( element, value ) )
03051                                 setDefaultHighlightColor( KDGanttViewItem::Event,
03052                                                  value , false);
03053                         } else if( tagName == "Task" ) {
03054                             QColor value;
03055                             if( KDGanttXML::readColorNode( element, value ) )
03056                                 setDefaultHighlightColor( KDGanttViewItem::Task,
03057                                                  value, false );
03058                         } else if( tagName == "Summary" ) {
03059                             QColor value;
03060                             if( KDGanttXML::readColorNode( element, value ) )
03061                                 setDefaultHighlightColor( KDGanttViewItem::Summary,
03062                                                  value, false );
03063                         } else {
03064                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03065                             Q_ASSERT( false );
03066                         }
03067                     }
03068 
03069                     node = node.nextSibling();
03070                 }
03071             } else if( tagName == "Items" ) {
03072                 QDomNode node = element.firstChild();
03073                 KDGanttViewItem* previous = 0;
03074                 while( !node.isNull() ) {
03075                     QDomElement element = node.toElement();
03076                     if( !element.isNull() ) { // was really an element
03077                         QString tagName = element.tagName();
03078                         if( tagName == "Item" ) {
03079                             KDGanttViewItem* newItem;
03080                             if( previous )
03081                                 newItem =
03082                                     KDGanttViewItem::createFromDomElement( this,
03083                                                                            previous,
03084                                                                            element );
03085                             else
03086                                 newItem =
03087                                     KDGanttViewItem::createFromDomElement( this,
03088                                                                            element );
03089                             previous = newItem;
03090                         } else {
03091                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03092                             Q_ASSERT( false );
03093                         }
03094                     }
03095 
03096                     node = node.nextSibling();
03097                 }
03098             } else if( tagName == "TaskLinks" ) {
03099                 QDomNode node = element.firstChild();
03100                 while( !node.isNull() ) {
03101                     QDomElement element = node.toElement();
03102                     if( !element.isNull() ) { // was really an element
03103                         QString tagName = element.tagName();
03104                         if( tagName == "TaskLink" )
03105                             KDGanttViewTaskLink::createFromDomElement( element );
03106                         else {
03107                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03108                             Q_ASSERT( false );
03109                         }
03110                     }
03111 
03112                     node = node.nextSibling();
03113                 }
03114             } else if( tagName == "TaskLinkGroups" ) {
03115                 QDomNode node = element.firstChild();
03116                 while( !node.isNull() ) {
03117                     QDomElement element = node.toElement();
03118                     if( !element.isNull() ) { // was really an element
03119                         QString tagName = element.tagName();
03120                         if( tagName == "TaskLink" )
03121                             KDGanttViewTaskLinkGroup::createFromDomElement( element );
03122                     } else {
03123                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03124                         Q_ASSERT( false );
03125                     }
03126 
03127                     node = node.nextSibling();
03128                 }
03129             } else if( tagName == "ColumnBackgroundColors" ) {
03130                 QDomNode node = element.firstChild();
03131                 while( !node.isNull() ) {
03132                     QDomElement element = node.toElement();
03133                     if( !element.isNull() ) { // was really an element
03134                         QString tagName = element.tagName();
03135                         if( tagName == "ColumnBackgroundColor" ) {
03136                             QDomNode node = element.firstChild();
03137                             QDateTime dateTime;
03138                             QColor color;
03139                             while( !node.isNull() ) {
03140                                 QDomElement element = node.toElement();
03141                                 if( !element.isNull() ) { // was
03142                                                           // really an
03143                                                           // element
03144                                     QString tagName = element.tagName();
03145                                     if( tagName == "DateTime" ) {
03146                                         QDateTime value;
03147                                         if( KDGanttXML::readDateTimeNode( element, value ) )
03148                                             dateTime = value;
03149                                     } else if( tagName == "Color" ) {
03150                                         QColor value;
03151                                         if( KDGanttXML::readColorNode( element, value ) )
03152                                             color = value;
03153                                     } else {
03154                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03155                                         Q_ASSERT( false );
03156                                     }
03157                                 }
03158 
03159                                 node = node.nextSibling();
03160                             }
03161                             setColumnBackgroundColor( dateTime, color );
03162                         } else {
03163                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03164                             Q_ASSERT( false );
03165                         }
03166                     }
03167                     node = node.nextSibling();
03168                 }
03169             } else if( tagName == "LegendItems" ) {
03170                 clearLegend();
03171                 QDomNode node = element.firstChild();
03172                 while( !node.isNull() ) {
03173                     QDomElement element = node.toElement();
03174                     if( !element.isNull() ) { // was really an element
03175                         QString tagName = element.tagName();
03176                         if( tagName == "LegendItem" ) {
03177                             KDGanttViewItem::Shape tempLegendShape;
03178                             tempLegendShape = KDGanttViewItem::TriangleDown;
03179                             QColor tempLegendColor;
03180                             QString tempLegendString;
03181                             bool ok = true;
03182                             QDomNode node = element.firstChild();
03183                             while( !node.isNull() ) {
03184                                 QDomElement element = node.toElement();
03185                                 if( !element.isNull() ) { // was really an element
03186                                     QString tagName = element.tagName();
03187                                     if( tagName == "Shape" ) {
03188                                         QString value;
03189                                         if( KDGanttXML::readStringNode( element, value ) )
03190                                             tempLegendShape = KDGanttViewItem::stringToShape( value );
03191                                         else
03192                                             ok = false;
03193                                     } else if( tagName == "Color" ) {
03194                                         QColor value;
03195                                         if( KDGanttXML::readColorNode( element, value ) )
03196                                             tempLegendColor = value;
03197                                         else
03198                                             ok = false;
03199                                     } else if( tagName == "Text" ) {
03200                                         QString value;
03201                                         if( KDGanttXML::readStringNode( element, value ) )
03202                                             tempLegendString = value;
03203                                         else
03204                                             ok = false;
03205                                     } else {
03206                                         qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03207                                         Q_ASSERT( false );
03208                                     }
03209                                 }
03210                                 node = node.nextSibling();
03211                             }
03212                             if( ok ) {
03213                                 addLegendItem( tempLegendShape,
03214                                                tempLegendColor,
03215                                                tempLegendString );
03216                                 qDebug( "Adding legend item %s", tempLegendString.latin1() );
03217                             }
03218                         } else {
03219                             qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03220                             Q_ASSERT( false );
03221                         }
03222                     }
03223                     node = node.nextSibling();
03224                 }
03225             } else {
03226                 qDebug( "Unrecognized tag name: %s", tagName.latin1() );
03227                 Q_ASSERT( false );
03228             }
03229         }
03230 
03231         node = node.nextSibling();
03232     } // while
03233         return true; /* FIXME: Do real error-reporting. The ASSERT's should be "return false" stmnts */
03234 } // method
03235 
03236 
03245 QDomDocument KDGanttView::saveXML( bool withPI ) const
03246 {
03247     // Create an inital DOM document
03248     QString docstart = "<GanttView/>";
03249 
03250     QDomDocument doc( "GanttView" );
03251     doc.setContent( docstart );
03252     if( withPI ) {
03253       QDomProcessingInstruction pin = doc.createProcessingInstruction( "kdgantt", "version=\"1.0\" encoding=\"UTF-8\""  ) ;
03254        doc.appendChild ( pin );
03255     }
03256 
03257     QDomElement docRoot = doc.documentElement();
03258     docRoot.setAttribute( "xmlns", "http://www.klaralvdalens-datakonsult.se/kdgantt" );
03259     docRoot.setAttribute( "xmlns:xsi", "http://www.w3.org/2000/10/XMLSchema-instance" );
03260     docRoot.setAttribute( "xsi:schemaLocation", "http://www.klaralvdalens-datakonsult.se/kdgantt" );
03261 
03262     // the ShowLegend element
03263     KDGanttXML::createBoolNode( doc, docRoot, "ShowLegend", showLegend() );
03264 
03265     // the ShowLegendButton element
03266     KDGanttXML::createBoolNode( doc, docRoot, "ShowLegendButton",
03267                            showLegendButton() );
03268 
03269     // the LegendIsDockWindow element
03270     KDGanttXML::createBoolNode( doc, docRoot, "LegendIsDockWindow",
03271                            legendIsDockwindow() );
03272 
03273     // the ShowListView element
03274     KDGanttXML::createBoolNode( doc, docRoot, "ShowListView", showListView() );
03275 
03276     // the ShowHeader element
03277     KDGanttXML::createBoolNode( doc, docRoot, "ShowHeader", headerVisible() );
03278 
03279     // the ShowTaskLinks element
03280     KDGanttXML::createBoolNode( doc, docRoot, "ShowTaskLinks", showTaskLinks() );
03281 
03282     // the EditorEnabled element
03283     KDGanttXML::createBoolNode( doc, docRoot, "EditorEnabled", editorEnabled() );
03284 
03285     // the global font element
03286     KDGanttXML::createFontNode( doc, docRoot, "GlobalFont", font() );
03287 
03288     // the DisplayEmptyTasksAsLine element
03289     KDGanttXML::createBoolNode( doc, docRoot, "DisplayEmptyTasksAsLine",
03290                            displayEmptyTasksAsLine() );
03291 
03292     // the HorizonStart element
03293     KDGanttXML::createDateTimeNode( doc, docRoot, "HorizonStart", horizonStart() );
03294 
03295     // the HorizonEnd element
03296     KDGanttXML::createDateTimeNode( doc, docRoot, "HorizonEnd", horizonEnd() );
03297 
03298     // the Scale, MinimumScale, MaximumScale elements
03299     KDGanttXML::createStringNode( doc, docRoot, "Scale", scaleToString( scale() ) );
03300     KDGanttXML::createStringNode( doc, docRoot, "MinimumScale",
03301                              scaleToString( minimumScale() ) );
03302     KDGanttXML::createStringNode( doc, docRoot, "MaximumScale",
03303                              scaleToString( maximumScale() ) );
03304 
03305     // the YearFormat element
03306     KDGanttXML::createStringNode( doc, docRoot, "YearFormat",
03307                              yearFormatToString( yearFormat() ) );
03308 
03309     // the HourFormat element
03310     KDGanttXML::createStringNode( doc, docRoot, "HourFormat",
03311                              hourFormatToString( hourFormat() ) );
03312 
03313     // the ShowMinorTicks element
03314     KDGanttXML::createBoolNode( doc, docRoot, "ShowMinorTicks", showMinorTicks() );
03315 
03316     // the ShowMajorTicks element
03317     KDGanttXML::createBoolNode( doc, docRoot, "ShowMajorTicks", showMajorTicks() );
03318 
03319     // the Editable element
03320     KDGanttXML::createBoolNode( doc, docRoot, "Editable", editable() );
03321 
03322     // the TextColor element
03323     KDGanttXML::createColorNode( doc, docRoot, "TextColor", textColor() );
03324 
03325     // the MajorScaleCount element
03326     KDGanttXML::createIntNode( doc, docRoot, "MajorScaleCount", majorScaleCount() );
03327 
03328     // the MinorScaleCount element
03329     KDGanttXML::createIntNode( doc, docRoot, "MinorScaleCount", minorScaleCount() );
03330 
03331     // the AutoScaleMinorTickCount element
03332     KDGanttXML::createIntNode( doc, docRoot, "AutoScaleMinorTickCount",
03333                           autoScaleMinorTickCount() );
03334 
03335     // the MinimumColumnWidth element
03336     KDGanttXML::createIntNode( doc, docRoot, "MinimumColumnWidth",
03337                           minimumColumnWidth() );
03338 
03339     // the GanttMaximumWidth element
03340     KDGanttXML::createIntNode( doc, docRoot, "GanttMaximumWidth",
03341                           ganttMaximumWidth() );
03342 
03343     // the NoInformationBrush element
03344     KDGanttXML::createBrushNode( doc, docRoot, "NoInformationBrush",
03345                             noInformationBrush() );
03346 
03347     // the GanttViewBackgroundColor element
03348     KDGanttXML::createColorNode( doc, docRoot, "GanttViewBackgroundColor",
03349                             gvBackgroundColor() );
03350 
03351     // the ListViewBackgroundColor element
03352     KDGanttXML::createColorNode( doc, docRoot, "ListViewBackgroundColor",
03353                             lvBackgroundColor() );
03354 
03355     // the TimeHeaderBackgroundColor element
03356     KDGanttXML::createColorNode( doc, docRoot, "TimeHeaderBackgroundColor",
03357                             timeHeaderBackgroundColor() );
03358 
03359     // the LegendHeaderBackgroundColor element
03360     KDGanttXML::createColorNode( doc, docRoot, "LegendHeaderBackgroundColor",
03361                             legendHeaderBackgroundColor() );
03362 
03363     // the WeekendBackgroundColor element
03364     KDGanttXML::createColorNode( doc, docRoot, "WeekendBackgroundColor",
03365                             weekendBackgroundColor() );
03366 
03367     // the WeekdayBackgroundColor elements
03368     for( int weekday = 1; weekday <= 7; weekday++ ) {
03369         QColor color = weekdayBackgroundColor( weekday );
03370         if( color.isValid() ) {
03371             QDomElement weekendBackgroundColorElement = doc.createElement( "WeekdayBackgroundColor" );
03372             docRoot.appendChild( weekendBackgroundColorElement );
03373             KDGanttXML::createIntNode( doc, weekendBackgroundColorElement,
03374                                   "Day", weekday );
03375             KDGanttXML::createColorNode( doc, weekendBackgroundColorElement,
03376                                     "Color", color );
03377         }
03378     }
03379 
03380     // the WeekendDays element
03381     QDomElement weekendDaysElement = doc.createElement( "WeekendDays" );
03382     docRoot.appendChild( weekendDaysElement );
03383     int weekendStart, weekendEnd;
03384     weekendDays( weekendStart, weekendEnd );
03385     weekendDaysElement.setAttribute( "Start", weekendStart );
03386     weekendDaysElement.setAttribute( "End", weekendStart );
03387 
03388     // the ZoomFactor element
03389     KDGanttXML::createDoubleNode( doc, docRoot, "ZoomFactor",
03390                              zoomFactor() );
03391 
03392     // the ShowHeaderPopupMenu element
03393     KDGanttXML::createBoolNode( doc, docRoot, "ShowHeaderPopupMenu",
03394                            showHeaderPopupMenu() );
03395 
03396     // the ShowTimeTablePopupMenu element
03397     KDGanttXML::createBoolNode( doc, docRoot, "ShowTimeTablePopupMenu",
03398                            showTimeTablePopupMenu() );
03399 
03400     // the Shapes element
03401     QDomElement shapesElement = doc.createElement( "Shapes" );
03402     docRoot.appendChild( shapesElement );
03403     QDomElement shapesEventElement = doc.createElement( "Event" );
03404     shapesElement.appendChild( shapesEventElement );
03405     KDGanttViewItem::Shape start, middle, end;
03406     if( shapes( KDGanttViewItem::Event, start, middle, end ) ) {
03407         KDGanttXML::createStringNode( doc, shapesEventElement, "Start",
03408                                  KDGanttViewItem::shapeToString( start ) );
03409         KDGanttXML::createStringNode( doc, shapesEventElement, "Middle",
03410                                  KDGanttViewItem::shapeToString( middle ) );
03411         KDGanttXML::createStringNode( doc, shapesEventElement, "End",
03412                                  KDGanttViewItem::shapeToString( end ) );
03413     } else {
03414         KDGanttXML::createStringNode( doc, shapesEventElement, "Start",
03415                                  "Undefined" );
03416         KDGanttXML::createStringNode( doc, shapesEventElement, "Middle",
03417                                  "Undefined" );
03418         KDGanttXML::createStringNode( doc, shapesEventElement, "End",
03419                                  "Undefined" );
03420     }
03421     QDomElement shapesTaskElement = doc.createElement( "Task" );
03422     shapesElement.appendChild( shapesTaskElement );
03423     if( shapes( KDGanttViewItem::Task, start, middle, end ) ) {
03424         KDGanttXML::createStringNode( doc, shapesTaskElement, "Start",
03425                                  KDGanttViewItem::shapeToString( start ) );
03426         KDGanttXML::createStringNode( doc, shapesTaskElement, "Middle",
03427                                  KDGanttViewItem::shapeToString( middle ) );
03428         KDGanttXML::createStringNode( doc, shapesTaskElement, "End",
03429                                  KDGanttViewItem::shapeToString( end ) );
03430     } else {
03431         KDGanttXML::createStringNode( doc, shapesTaskElement, "Start",
03432                                  "Undefined" );
03433         KDGanttXML::createStringNode( doc, shapesTaskElement, "Middle",
03434                                  "Undefined" );
03435         KDGanttXML::createStringNode( doc, shapesTaskElement, "End",
03436                                  "Undefined" );
03437     }
03438     QDomElement shapesSummaryElement = doc.createElement( "Summary" );
03439     shapesElement.appendChild( shapesSummaryElement );
03440     if( shapes( KDGanttViewItem::Event, start, middle, end ) ) {
03441         KDGanttXML::createStringNode( doc, shapesSummaryElement, "Start",
03442                                  KDGanttViewItem::shapeToString( start ) );
03443         KDGanttXML::createStringNode( doc, shapesSummaryElement, "Middle",
03444                                  KDGanttViewItem::shapeToString( middle ) );
03445         KDGanttXML::createStringNode( doc, shapesSummaryElement, "End",
03446                                  KDGanttViewItem::shapeToString( end ) );
03447     } else {
03448         KDGanttXML::createStringNode( doc, shapesSummaryElement, "Start",
03449                                  "Undefined" );
03450         KDGanttXML::createStringNode( doc, shapesSummaryElement, "Middle",
03451                                  "Undefined" );
03452         KDGanttXML::createStringNode( doc, shapesSummaryElement, "End",
03453                                  "Undefined" );
03454     }
03455 
03456     // the Colors element
03457     QDomElement colorsElement = doc.createElement( "Colors" );
03458     docRoot.appendChild( colorsElement );
03459     QDomElement colorsEventElement = doc.createElement( "Event" );
03460     colorsElement.appendChild( colorsEventElement );
03461     QColor startColor, middleColor, endColor;
03462     colors( KDGanttViewItem::Event, startColor, middleColor, endColor );
03463     KDGanttXML::createColorNode( doc, colorsEventElement, "Start", startColor );
03464     KDGanttXML::createColorNode( doc, colorsEventElement, "Middle", middleColor );
03465     KDGanttXML::createColorNode( doc, colorsEventElement, "End", endColor );
03466     QDomElement colorsTaskElement = doc.createElement( "Task" );
03467     colorsElement.appendChild( colorsTaskElement );
03468     colors( KDGanttViewItem::Task, startColor, middleColor, endColor );
03469     KDGanttXML::createColorNode( doc, colorsTaskElement, "Start", startColor );
03470     KDGanttXML::createColorNode( doc, colorsTaskElement, "Middle", middleColor );
03471     KDGanttXML::createColorNode( doc, colorsTaskElement, "End", endColor );
03472     QDomElement colorsSummaryElement = doc.createElement( "Summary" );
03473     colorsElement.appendChild( colorsSummaryElement );
03474     colors( KDGanttViewItem::Event, startColor, middleColor, endColor );
03475     KDGanttXML::createColorNode( doc, colorsSummaryElement, "Start", startColor );
03476     KDGanttXML::createColorNode( doc, colorsSummaryElement, "Middle", middleColor );
03477     KDGanttXML::createColorNode( doc, colorsSummaryElement, "End", endColor );
03478 
03479     // the DefaultColor element
03480     QDomElement defaultColorsElement = doc.createElement( "DefaultColors" );
03481     docRoot.appendChild( defaultColorsElement );
03482     KDGanttXML::createColorNode( doc, defaultColorsElement, "Event",
03483                             defaultColor( KDGanttViewItem::Event ) );
03484     KDGanttXML::createColorNode( doc, defaultColorsElement, "Task",
03485                             defaultColor( KDGanttViewItem::Task ) );
03486     KDGanttXML::createColorNode( doc, defaultColorsElement, "Summary",
03487                             defaultColor( KDGanttViewItem::Summary ) );
03488 
03489 
03490     // the HighlightColors element
03491     QDomElement highlightColorsElement = doc.createElement( "HighlightColors" );
03492     docRoot.appendChild( highlightColorsElement );
03493     QDomElement highlightColorsEventElement = doc.createElement( "Event" );
03494     highlightColorsElement.appendChild( highlightColorsEventElement );
03495     highlightColors( KDGanttViewItem::Event, startColor, middleColor, endColor );
03496     KDGanttXML::createColorNode( doc, highlightColorsEventElement, "Start", startColor );
03497     KDGanttXML::createColorNode( doc, highlightColorsEventElement, "Middle", middleColor );
03498     KDGanttXML::createColorNode( doc, highlightColorsEventElement, "End", endColor );
03499     QDomElement highlightColorsTaskElement = doc.createElement( "Task" );
03500     highlightColorsElement.appendChild( highlightColorsTaskElement );
03501     highlightColors( KDGanttViewItem::Task, startColor, middleColor, endColor );
03502     KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "Start", startColor );
03503     KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "Middle", middleColor );
03504     KDGanttXML::createColorNode( doc, highlightColorsTaskElement, "End", endColor );
03505     QDomElement highlightColorsSummaryElement = doc.createElement( "Summary" );
03506     highlightColorsElement.appendChild( highlightColorsSummaryElement );
03507     highlightColors( KDGanttViewItem::Event, startColor, middleColor, endColor );
03508     KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Start", startColor );
03509     KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Middle", middleColor );
03510     KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "End", endColor );
03511 
03512 
03513     /*
03514     if( highlightColors( KDGanttViewItem::Event, startColor, middleColor, endColor ) ) {
03515         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Start", startColor );
03516         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Middle", middleColor );
03517         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "End", endColor );
03518     } else {
03519         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Start", QColor() );
03520         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "Middle", QColor() );
03521         KDGanttXML::createColorNode( doc, highlightColorsSummaryElement, "End", QColor() );
03522     }
03523     */
03524     // the DefaultHighlightColor element
03525     QDomElement defaultHighlightColorsElement = doc.createElement( "DefaultHighlightColors" );
03526     docRoot.appendChild( defaultHighlightColorsElement );
03527     KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Event",
03528                             defaultHighlightColor( KDGanttViewItem::Event ) );
03529     KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Task",
03530                             defaultHighlightColor( KDGanttViewItem::Task ) );
03531     KDGanttXML::createColorNode( doc, defaultHighlightColorsElement, "Summary",
03532                             defaultHighlightColor( KDGanttViewItem::Summary ) );
03533 
03534 
03535     // the Items element
03536     QDomElement itemsElement = doc.createElement( "Items" );
03537     docRoot.appendChild( itemsElement );
03538     KDGanttViewItem* currentItem = firstChild();
03539     while( currentItem ) {
03540         currentItem->createNode( doc, itemsElement );
03541         currentItem = currentItem->nextSibling();
03542     }
03543 
03544     // the TaskLinks element
03545     QDomElement taskLinksElement = doc.createElement( "TaskLinks" );
03546     docRoot.appendChild( taskLinksElement );
03547     QPtrList<KDGanttViewTaskLink> taskLinkList = taskLinks();
03548     KDGanttViewTaskLink* currentTL = 0;
03549     for( currentTL = taskLinkList.first(); currentTL;
03550          currentTL = taskLinkList.next() )
03551         currentTL->createNode( doc, taskLinksElement );
03552 
03553     // the TaskLinkGroups element
03554     QDomElement taskLinkGroupsElement = doc.createElement( "TaskLinkGroups" );
03555     docRoot.appendChild( taskLinkGroupsElement );
03556     QPtrList<KDGanttViewTaskLinkGroup> taskLinkGroupList = taskLinkGroups();
03557     KDGanttViewTaskLinkGroup* currentTLG = 0;
03558     for( currentTLG = taskLinkGroupList.first(); currentTLG;
03559          currentTLG = taskLinkGroupList.next() )
03560         currentTLG->createNode( doc, taskLinkGroupsElement );
03561 
03562     // the ColumnBackgroundColors element
03563     QDomElement columnBackgroundColorsElement =
03564         doc.createElement( "ColumnBackgroundColors" );
03565     docRoot.appendChild( columnBackgroundColorsElement );
03566     KDTimeHeaderWidget::ColumnColorList ccList =
03567         myTimeHeader->columnBackgroundColorList();
03568     for( KDTimeHeaderWidget::ColumnColorList::iterator it = ccList.begin();
03569          it != ccList.end(); ++it ) {
03570         QDomElement columnBackgroundColorElement =
03571             doc.createElement( "ColumnBackgroundColor" );
03572         columnBackgroundColorsElement.appendChild( columnBackgroundColorElement );
03573         KDGanttXML::createDateTimeNode( doc, columnBackgroundColorElement,
03574                                    "DateTime", (*it).datetime );
03575         KDGanttXML::createColorNode( doc, columnBackgroundColorElement,
03576                                 "Color", (*it).color );
03577     }
03578 
03579     // the LegendItems element
03580     QDomElement legendItemsElement =
03581         doc.createElement( "LegendItems" );
03582     docRoot.appendChild( legendItemsElement );
03583     legendItem* current;
03584     QPtrListIterator<legendItem> lit( *myLegendItems );
03585     while( ( current = lit.current() ) ) {
03586         ++lit;
03587         QDomElement legendItemElement = doc.createElement( "LegendItem" );
03588         legendItemsElement.appendChild( legendItemElement );
03589         KDGanttXML::createStringNode( doc, legendItemElement, "Shape",
03590                                  KDGanttViewItem::shapeToString( current->shape ) );
03591         KDGanttXML::createColorNode( doc, legendItemElement, "Color",
03592                                 current->color );
03593         KDGanttXML::createStringNode( doc, legendItemElement, "Text",
03594                                  current->text );
03595     }
03596 
03597     // the DragEnabled element
03598     KDGanttXML::createBoolNode( doc, docRoot, "DragEnabled", isDragEnabled() );
03599 
03600     // the DropEnabled element
03601     KDGanttXML::createBoolNode( doc, docRoot, "DropEnabled", isDropEnabled() );
03602 
03603     // the CalendarMode element
03604     KDGanttXML::createBoolNode( doc, docRoot, "CalendarMode", calendarMode() );
03605 
03606     return doc;
03607 }
03608 
03609 
03610 
03611 QString KDGanttView::scaleToString( Scale scale )
03612 {
03613     switch( scale ) {
03614     case Minute:
03615         return "Minute";
03616     case Hour:
03617         return "Hour";
03618     case Day:
03619         return "Day";
03620     case Week:
03621         return "Week";
03622     case Month:
03623         return "Month";
03624     case Auto:
03625         return "Auto";
03626     }
03627     return "";
03628 }
03629 
03630 
03631 KDGanttView::Scale KDGanttView::stringToScale( const QString& string )
03632 {
03633     if( string == "Minute" )
03634         return Minute;
03635     else if( string == "Hour" )
03636         return Hour;
03637     else if( string == "Day" )
03638         return Day;
03639     else if( string == "Week" )
03640         return Week;
03641     else if( string == "Month" )
03642         return Month;
03643     else if( string == "Auto" )
03644         return Auto;
03645 
03646     return Auto;
03647 }
03648 
03649 
03650 QString KDGanttView::yearFormatToString( YearFormat format )
03651 {
03652     switch( format ) {
03653     case FourDigit:
03654         return "FourDigit";
03655     case TwoDigit:
03656         return "TwoDigit";
03657     case TwoDigitApostrophe:
03658         return "TwoDigitApostrophe";
03659     case NoDate:
03660         return "NoDate";
03661     }
03662     return "";
03663 }
03664 
03665 
03666 KDGanttView::YearFormat KDGanttView::stringToYearFormat( const QString& string )
03667 {
03668     if( string == "FourDigit" )
03669         return FourDigit;
03670     else if( string == "TwoDigit" )
03671         return TwoDigit;
03672     else if( string == "TwoDigitApostrophe" )
03673         return TwoDigitApostrophe;
03674     else if( string == "NoDate" )
03675         return NoDate;
03676     else
03677         return FourDigit;
03678 }
03679 
03680 
03681 QString KDGanttView::hourFormatToString( HourFormat format )
03682 {
03683     switch( format ) {
03684     case Hour_12:
03685         return "Hour_12";
03686     case Hour_24:
03687         return "Hour_24";
03688     case Hour_24_FourDigit:
03689         return "Hour_24_FourDigit";
03690     }
03691     return "";
03692 }
03693 
03694 
03695 KDGanttView::HourFormat KDGanttView::stringToHourFormat( const QString& string )
03696 {
03697     if( string == "Hour_12" )
03698         return Hour_12;
03699     else if( string == "Hour_24" )
03700         return Hour_24;
03701     else
03702         return Hour_24;
03703 }
03704 
03705 
03706 void KDGanttView::addTaskLinkGroup(KDGanttViewTaskLinkGroup* group)
03707 {
03708 
03709   if (myTaskLinkGroupList.isEmpty()) {
03710     myTaskLinkGroupList.append(group);
03711     return;
03712   }
03713     if (myTaskLinkGroupList.find(group) == -1)
03714         myTaskLinkGroupList.append(group);
03715 }
03716 
03717 
03718 void KDGanttView::removeTaskLinkGroup(KDGanttViewTaskLinkGroup* group)
03719 {
03720     myTaskLinkGroupList.remove(group);
03721 }
03722 
03723 
03729 void KDGanttView::editItem( KDGanttViewItem*  item)
03730 {
03731   if ( ! item )
03732     return;
03733   if ( editorEnabled() ) {
03734     if ( item->editable() ) {
03735       myItemAttributeDialog->reset( item );
03736       myItemAttributeDialog->show();
03737     }
03738   }
03739 }
03740 
03741 
03752 QPixmap KDGanttView::getPixmap( KDGanttViewItem::Shape shape,
03753                                 const QColor& shapeColor,
03754                                 const QColor& backgroundColor, int itemSize)
03755 {
03756   // 10 is a good value as size
03757   int size = itemSize+2;
03758   int hei = ( itemSize/3 ) / 2;
03759   QPixmap p = QPixmap( size+4, size+4 );
03760   p.fill( backgroundColor );
03761   QPainter paint (&p);
03762   QBrush b = QBrush ( Qt::SolidPattern );
03763   b.setColor( shapeColor );
03764   paint.setBrush( b );
03765   QPen pen( Qt::black, 1 ) ;
03766   paint.setPen( pen );
03767   switch (shape) {
03768   case KDGanttViewItem::TriangleDown:{
03769     QPointArray arr = QPointArray(3);
03770     arr.setPoint(0,-size/2,-hei);
03771     arr.setPoint(1,size/2,-hei);
03772     arr.setPoint(2,0,((size/2)-hei));
03773     arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
03774     paint.drawPolygon( arr );
03775     break;
03776   }
03777   case KDGanttViewItem::TriangleUp :{
03778     QPointArray arr = QPointArray(3);
03779     arr.setPoint(0,-size/2,hei);
03780     arr.setPoint(1,size/2,hei);
03781     arr.setPoint(2,0,(-size/2)+hei);
03782     arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
03783     paint.drawPolygon( arr );
03784     break;
03785   }
03786   case  KDGanttViewItem::Diamond :{
03787     QPointArray arr = QPointArray(4);
03788     arr.setPoint(0,0,-size/2);
03789     arr.setPoint(1,size/2,0);
03790     arr.setPoint(2,0,size/2);
03791     arr.setPoint(3,-size/2,0);
03792     arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
03793     paint.drawPolygon( arr );
03794     break;
03795   }
03796   case KDGanttViewItem::Square :{
03797     QPointArray arr = QPointArray(4);
03798     arr.setPoint(0,-size/2,-size/2);
03799     arr.setPoint(1,size/2,-size/2);
03800     arr.setPoint(2,size/2,size/2);
03801     arr.setPoint(3,-size/2,size/2);
03802     arr.translate( ( size/2 ) +2 , ( size/2 ) +2);
03803     paint.drawPolygon( arr );
03804     break;
03805   }
03806   case  KDGanttViewItem::Circle  :{
03807     paint.drawEllipse( 2, 2, size, size);
03808     break;
03809   }
03810   }
03811   paint.end();
03812   return p;
03813 }
03814 
03815 int KDGanttView::getIndex( KDGanttViewItem::Type type) const
03816 {
03817     int index = -1;
03818     switch (type) {
03819     case (KDGanttViewItem::Event):
03820         index = 0;
03821         break;
03822     case (KDGanttViewItem::Task):
03823         index = 1;
03824         break;
03825     case (KDGanttViewItem::Summary):
03826         index = 2;
03827         break;
03828     }
03829     return index;
03830 }
03831 
03832 
03833 void KDGanttView::initDefaults()
03834 {
03835   int i;
03836   // We have 3 item types. Set all undefined to true.
03837     for (i = 0;i<3;++i) {
03838         undefinedShape[i] = true;
03839         undefinedColor[i] = true;
03840         undefinedColorHL[i] = true;
03841     }
03842     // setting the default colors
03843     myDefaultColor [ getIndex( KDGanttViewItem::Event ) ] =  Qt::blue; //event
03844     myDefaultColorHL [ getIndex( KDGanttViewItem::Event ) ] =  Qt::red;
03845     myDefaultColor [ getIndex( KDGanttViewItem::Task ) ] =  Qt::green;//task
03846     myDefaultColorHL [ getIndex( KDGanttViewItem::Task ) ] =  Qt::red;
03847     myDefaultColor [ getIndex( KDGanttViewItem::Summary ) ] =  Qt::cyan;//summary
03848     myDefaultColorHL [ getIndex( KDGanttViewItem::Summary ) ] =  Qt::red;
03849 
03850     // setting the default shape types
03851     // currently, we take for each item for all three shapes (start, middle, end) the same default shape
03852     for (i = 0;i<3;++i) {
03853       myDefaultShape [3*getIndex( KDGanttViewItem::Event )+ i] =  KDGanttViewItem::Diamond; //event
03854       myDefaultShape [3*getIndex( KDGanttViewItem::Task ) +i] =  KDGanttViewItem::Square; //task
03855       myDefaultShape [3*getIndex( KDGanttViewItem::Summary ) +i] =  KDGanttViewItem::TriangleDown; //summary
03856 
03857     }
03858 }
03859 
03860 
03861 
03865 int KDGanttView::addColumn( const QString& label, int width )
03866 {
03867     return myListView->addColumn( label, width );
03868 }
03869 
03870 
03875 int KDGanttView::addColumn( const QIconSet& iconset, const QString& label,
03876                             int width )
03877 {
03878     return myListView->addColumn( iconset, label, width );
03879 }
03880 
03881 
03885 void KDGanttView::removeColumn( int index )
03886 {
03887     myListView->removeColumn( index );
03888 }
03889 
03890 
03894 KDGanttViewItem* KDGanttView::selectedItem() const
03895 {
03896     return static_cast<KDGanttViewItem*>( myListView->selectedItem() );
03897 }
03898 
03899 
03903 void KDGanttView::setSelected( KDGanttViewItem* item, bool selected )
03904 {
03905     myListView->setSelected( item, selected );
03906 }
03907 
03908 
03921 KDGanttViewItem* KDGanttView::getItemByName( const QString& name ) const
03922 {
03923     KDGanttViewItem* temp =  firstChild(),* ret;
03924     while (temp != 0) {
03925       if ( (ret = temp->getChildByName( name ) ) )
03926         return ret;
03927       temp = temp->nextSibling();
03928     }
03929     return 0;
03930 }
03931 
03932 
03944 KDGanttViewItem* KDGanttView::getItemByListViewPos( const QPoint& pos ) const
03945 {
03946     return static_cast<KDGanttViewItem*>( myListView->itemAt(myListView->mapFromGlobal(pos) ));
03947 }
03948 
03949 
03964 KDGanttViewItem* KDGanttView::getItemByGanttViewPos( const QPoint& pos ) const
03965 {
03966   KDGanttViewItem* item;
03967   QPoint local = myCanvasView->mapFromGlobal(pos);
03968 
03969     QCanvasItemList il = myTimeTable->collisions( myCanvasView->viewportToContents( local ));
03970     QCanvasItemList::Iterator it;
03971     for ( it = il.begin(); it != il.end(); ++it ) {
03972       if ( myCanvasView->getType(*it) == Type_is_KDGanttViewItem) {
03973         item = myCanvasView->getItem(*it);
03974         if ( item->enabled() )
03975           return item;
03976       }
03977     }
03978     return 0;
03979 }
03980 
03981 
03996 KDGanttViewItem* KDGanttView::getItemAt( const QPoint& pos, bool global ) const
03997 {
03998   /* buggy code - commented out
03999   QPoint myPos;
04000   if (  global )
04001     myPos = myListView->contentsToViewport( myListView->mapFromGlobal(pos) );
04002   else
04003      myPos = myListView->contentsToViewport( pos );
04004   return (KDGanttViewItem*) myListView->itemAt( myPos );
04005   */
04006 
04007   KDGanttViewItem* item;
04008   KDGanttViewItem* retItem = 0;
04009   int y;
04010   if ( global )
04011     y = myCanvasView->mapFromGlobal(pos).y();
04012   else
04013     y = pos.y();
04014   item = firstChild();
04015   while ( item != 0 ) {
04016     int yc = item->itemPos();
04017     if ( yc <= y && y < yc + item->height()) {
04018       retItem = item;
04019       break;
04020     }
04021     item = item->itemBelow();
04022   }
04023   return retItem;
04024 
04025 }
04026 
04027 
04028 void KDGanttView::addTickRight()
04029 {
04030   if ( _enableAdding && myCanvasView->horizontalScrollBar()->value() ==  myCanvasView->horizontalScrollBar()->maxValue()) {
04031     //myCanvasView->horizontalScrollBar()->blockSignals( true );
04032     myTimeHeader->addTickRight();
04033     //myCanvasView->horizontalScrollBar()->blockSignals( false );
04034     myCanvasView->updateHorScrollBar();
04035     setTimelineToEnd();
04036   }
04037 }
04038 
04039 
04040 void KDGanttView::addTickLeft()
04041 {
04042   if ( _enableAdding && myCanvasView->horizontalScrollBar()->value() == 0 ) {
04043     myCanvasView->horizontalScrollBar()->blockSignals( true );
04044     myTimeHeader->addTickLeft();
04045     myCanvasView->horizontalScrollBar()->blockSignals( false );
04046     setTimelineToStart();
04047   }
04048 }
04049 
04050 
04051 void KDGanttView::enableAdding( int val )
04052 {
04053   _enableAdding = ( val == 0 || val == myCanvasView->horizontalScrollBar()->maxValue());
04054 }
04055 
04056 
04062 int KDGanttView::childCount() const
04063 {
04064     return myListView->childCount();
04065 }
04066 
04067 
04071 void KDGanttView::clear()
04072 {
04073   bool block = myTimeTable->blockUpdating();
04074   myTimeTable->setBlockUpdating( true );
04075   myListView->clear();
04076   myTimeTable->setBlockUpdating( false );
04077   myTimeTable->updateMyContent();
04078   myTimeTable->setBlockUpdating( block );
04079 }
04080 
04081 
04085 void KDGanttView::slot_lvDropped(QDropEvent* e, KDGanttViewItem* droppedItem, KDGanttViewItem* itemBelowMouse  )
04086 {
04087   emit dropped( e, droppedItem, itemBelowMouse);
04088 }
04089 
04093 QDragObject * KDGanttView::dragObject ()
04094 {
04095   return myListView->dragObject ();
04096 }
04097 
04098 
04102 void KDGanttView::startDrag ()
04103 {
04104   //myListView->pt_startDrag ();
04105 }
04106 
04107 
04111 void KDGanttView::setPaletteBackgroundColor( const QColor& col)
04112 {
04113   QWidget::setPaletteBackgroundColor( col );
04114   timeHeaderSpacerWidget->setPaletteBackgroundColor( col );
04115 }
04116 
04117 
04124 void KDGanttView::setGvBackgroundColor ( const QColor & c )
04125 {
04126   myTimeTable->setBackgroundColor( c );
04127 }
04128 
04129 
04136 void KDGanttView::setTimeHeaderBackgroundColor ( const QColor & c )
04137 {
04138   myTimeHeader->setPaletteBackgroundColor( c );
04139   //rightWidget->setPaletteBackgroundColor( c );
04140   timeHeaderSpacerWidget->setPaletteBackgroundColor( c );
04141 }
04142 
04143 
04150 void KDGanttView::setLegendHeaderBackgroundColor ( const QColor & c )
04151 {
04152   myLegend->setPaletteBackgroundColor( c );
04153   leftWidget->setPaletteBackgroundColor( c );
04154 }
04155 
04156 
04163 void KDGanttView::setLvBackgroundColor ( const QColor & c )
04164 {
04165  myListView->viewport()->setPaletteBackgroundColor( c );
04166 }
04167 
04168 
04175 QColor KDGanttView::lvBackgroundColor ( )const
04176 {
04177  return myListView->viewport()->paletteBackgroundColor( );
04178 }
04179 
04180 
04187 QColor KDGanttView::gvBackgroundColor () const
04188 {
04189  return myTimeTable->backgroundColor( );
04190 }
04191 
04192 
04199 QColor KDGanttView::timeHeaderBackgroundColor () const
04200 {
04201  return myTimeHeader->paletteBackgroundColor( );
04202 }
04203 
04204 
04211 QColor KDGanttView::legendHeaderBackgroundColor () const
04212 {
04213  return myLegend->paletteBackgroundColor( );
04214 }
04215 
04216 
04231 void KDGanttView::addUserdefinedLegendHeaderWidget( QWidget * w )
04232 {
04233   if ( w ) {
04234     w->reparent ( spacerLeft, 0, QPoint(0,0) );
04235   }
04236 }
04237 
04238 
04247 void KDGanttView::setDragEnabled( bool b )
04248 {
04249   fDragEnabled = b;
04250  QListViewItemIterator it( myListView );
04251  for ( ; it.current(); ++it ) {
04252    (( KDGanttViewItem* )it.current())->setDragEnabled(b);
04253  }
04254 
04255 }
04256 
04257 
04266 void KDGanttView::setDropEnabled( bool b )
04267 {
04268   fDropEnabled = b;
04269 
04270   //myListView->setAcceptDrops( b );
04271  QListViewItemIterator it( myListView );
04272  for ( ; it.current(); ++it ) {
04273    (( KDGanttViewItem* )it.current())->setDropEnabled(b);
04274  }
04275 }
04276 
04277 
04286 void KDGanttView::setDragDropEnabled( bool b )
04287 {
04288   setDropEnabled( b );
04289   setDragEnabled( b );
04290 }
04291 
04292 
04299 bool KDGanttView::isDragEnabled() const
04300 {
04301   return fDragEnabled;
04302 }
04303 
04304 
04311 bool KDGanttView::isDropEnabled() const
04312 {
04313  return fDropEnabled;
04314 }
04315 
04316 
04320 bool KDGanttView::dragEnabled() const
04321 {
04322   return isDragEnabled();
04323 }
04324 
04325 
04329 bool KDGanttView::dropEnabled() const
04330 {
04331  return isDropEnabled();
04332 }
04333 
04334 
04361 bool  KDGanttView::lvDropEvent ( QDropEvent* e,
04362                                  KDGanttViewItem* droppedItem,
04363                                  KDGanttViewItem* itemBelowMouse )
04364 {
04365     Q_UNUSED( e );
04366     Q_UNUSED( droppedItem );
04367     Q_UNUSED( itemBelowMouse );
04368 
04369   // Example code for user defined behaviour:
04370   // we want to accept the usual drags and the drags of files, which may be
04371   // a saved Gantt file.
04372   // Please uncomment the following lines for this behaviour
04373   // You have to uncomment lines in lvDragMoveEvent() and llvDragEnterEvent() as well
04374 
04375   // ************** begin example ************
04376   /*
04377   if ( QUriDrag::canDecode( e ) ) {
04378     QStrList lst;
04379     QUriDrag::decode( e, lst );
04380     // we try the first file of icon-url-list
04381     QString str = lst.at ( 0 );
04382     // remove file: at beginning of string
04383     str = str.right( str.length() - 5  );
04384     QFileInfo info;
04385     info.setFile( str ) ;
04386     if ( info.isFile() ) {
04387       if (!QMessageBox::information( this, "KDGantt Drag&Drop test",
04388                                      "Try to insert file: "+ str + " ?",
04389                                      "&Okay", "&Cancel",0,1  ) ) {
04390         QFile file( str );
04391         // store current updating status
04392         bool uen = myTimeTable->blockUpdating();
04393         // block updating while insertion of items
04394         myTimeTable->setBlockUpdating();
04395         loadProject( &file ) ;
04396         // restore updating status and execute an update via setUpdateEnabled( true );
04397         if ( !uen )
04398           setUpdateEnabled( true );
04399       }
04400     }
04401     return true;
04402   }
04403   */
04404   // *********** end example ****************
04405   return false;
04406 }
04407 
04408 
04425 void  KDGanttView::lvDragEnterEvent ( QDragEnterEvent * e)
04426 {
04427   // the standard behaviour:
04428   // accept drag enter events, if KDGanttViewItemDrag can decode the event
04429   // e->accept(KDGanttViewItemDrag::canDecode(e) );
04430 
04431   if ( KDGanttViewItemDrag::canDecode(e) ) {
04432     e->accept( true);
04433     return;
04434   }
04435 
04436   // example code for user defined behaviour:
04437   // we want to accecpt the usual drags and the drags of files, which may be
04438   // a saved Gantt file
04439   // Please uncomment the following lines for this behaviour
04440   // You have to uncomment lines in lvDragMoveEvent() and lvDropEvent () as well
04441 
04442   //  if ( QUriDrag::canDecode( e ) ) {
04443   // e->accept(true);
04444   //  return;
04445   // }
04446 
04447   e->accept( false );
04448 }
04449 
04450 
04479 bool  KDGanttView::lvDragMoveEvent ( QDragMoveEvent* /*e*/,
04480                                      KDGanttViewItem* /* draggedItem*/,
04481                                      KDGanttViewItem* /*itemBelowMouse*/)
04482 {
04483 
04484   // Example code 1:
04485   // To generally block items to be inserted as root items, subclass KDGanttView
04486   // and reimplement this method with to following code uncommented:
04487 
04488   // if ( !itemBelowMouse ) {
04489   //  e->accept( false );
04490   //  return true;
04491   //}
04492   //return false;
04493 
04494   // Example code 2:
04495   // To allow the drags of files, which may be
04496   // a saved Gantt file, subclass KDGanttView
04497   // and reimplement this method with to following code uncommented:
04498 
04499   // if ( QUriDrag::canDecode( e ) ) {
04500   //   e->accept(true);
04501   //   return true;
04502   //  }
04503 
04504 
04505  // normal behaviour - the internal drag move event handling should be executed
04506   return false;
04507 }
04508 
04509 
04519 void  KDGanttView::lvStartDrag (KDGanttViewItem* item)
04520 {
04521   QDragObject* d = new KDGanttViewItemDrag(item, this, "itemdrag" );
04522   // call d->drag() to start the dragging
04523   // d->drag() returns true, if a move was requested as a drag
04524   // if a copy (by pressing the <Ctrl>-key) was performed, d->drag() returns false
04525   // In order to avoid starting drags for particular items, subclass KDGanttView
04526   // an reimplement this method.
04527   // insert here some code like
04528   // if ( item->parent() )
04529   // return;
04530   // This particular code will make it impossible to drag other items but root items.
04531   if ( d->drag()  ) {
04532       delete item;
04533   }
04534 }
04535 
04536 
04544 void  KDGanttView::setListViewWidth( int w )
04545 {
04546   int sw = mySplitter->width();
04547   QValueList<int> list;
04548   list.append(w);
04549   list.append(sw-w);
04550   mySplitter->setSizes( list );
04551 }
04552 
04553 
04560 int  KDGanttView::listViewWidth( )
04561 {
04562   return leftWidget->width();
04563 }
04564 
04565 
04575 void  KDGanttView::setLvVScrollBarMode( QScrollView::ScrollBarMode m )
04576 {
04577   myListView->setVScrollBarMode ( m );
04578 }
04579 
04580 
04590 void  KDGanttView::setGvVScrollBarMode( QScrollView::ScrollBarMode m )
04591 {
04592   if ( m == QScrollView::Auto )
04593     qDebug("KDGanttView::setListViewVScrollBarMode: QScrollView::Auto not supported. Nothing changed. ");
04594   else
04595     {
04596       myCanvasView->setVScrollBarMode ( m );
04597       if ( m == QScrollView::AlwaysOn )
04598         timeHeaderSpacerWidget->setFixedWidth(myCanvasView->verticalScrollBar()->width() );
04599       else
04600         timeHeaderSpacerWidget->setFixedWidth( 0 );
04601     }
04602 }
04603 
04604 
04605 void  KDGanttView::notifyEditdialog( KDGanttViewItem * item)
04606 {
04607   if (myItemAttributeDialog->getItem() == item ) {
04608     myItemAttributeDialog->reset( 0 );
04609   }
04610 }
04611 
04619 void KDGanttView::setLinkItemsEnabled(bool on)
04620 {
04621     myCanvasView->linkItemsEnabled = on;
04622     myCanvasView->autoScrollEnabled = true;    
04623 }
04624 
04630 bool KDGanttView::isLinkItemsEnabled() const 
04631 {
04632     return myCanvasView->linkItemsEnabled;
04633 }
04634 
KDE Home | KDE Accessibility Home | Description of Access Keys