summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-05 10:58:25 (UTC)
committer zautrix <zautrix>2005-07-05 10:58:25 (UTC)
commitea75d46072630883fae6ededd4af1d3c427ff59f (patch) (unidiff)
tree60c96620f59441cf0ff998e7e4edd5b2bc8007d9 /korganizer
parent7e49703511de87f624cc8813b18ebbfcc01752cd (diff)
downloadkdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.zip
kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.gz
kdepimpi-ea75d46072630883fae6ededd4af1d3c427ff59f.tar.bz2
fixx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp23
-rw-r--r--korganizer/koagendaview.cpp15
-rw-r--r--korganizer/kofilterview.cpp23
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/koprefs.cpp6
-rw-r--r--korganizer/koprefs.h4
6 files changed, 49 insertions, 23 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 662576f..92c1cd6 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -76,25 +76,25 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
76 QPalette pal = mTimeBox->palette(); 76 QPalette pal = mTimeBox->palette();
77 pal.setColor(QColorGroup::Foreground, Qt::red); 77 pal.setColor(QColorGroup::Foreground, Qt::red);
78 mTimeBox->setPalette(pal); 78 mTimeBox->setPalette(pal);
79 //mTimeBox->setAutoMask(true); 79 //mTimeBox->setAutoMask(true);
80 80
81 agenda->addChild(mTimeBox); 81 agenda->addChild(mTimeBox);
82 82
83 oldToday = -1; 83 oldToday = -1;
84} 84}
85 85
86MarcusBains::~MarcusBains() 86MarcusBains::~MarcusBains()
87{ 87{
88 delete minutes; 88 //delete minutes;
89} 89}
90 90
91int MarcusBains::todayColumn() 91int MarcusBains::todayColumn()
92{ 92{
93 QDate currentDate = QDate::currentDate(); 93 QDate currentDate = QDate::currentDate();
94 94
95 DateList dateList = agenda->dateList(); 95 DateList dateList = agenda->dateList();
96 DateList::ConstIterator it; 96 DateList::ConstIterator it;
97 int col = 0; 97 int col = 0;
98 for(it = dateList.begin(); it != dateList.end(); ++it) { 98 for(it = dateList.begin(); it != dateList.end(); ++it) {
99 if((*it) == currentDate) 99 if((*it) == currentDate)
100 return KOGlobals::self()->reverseLayout() ? 100 return KOGlobals::self()->reverseLayout() ?
@@ -142,28 +142,29 @@ void MarcusBains::updateLocation(bool recalculate)
142 //mTimeBox->setFont(QFont("helvetica",10)); 142 //mTimeBox->setFont(QFont("helvetica",10));
143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); 143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont);
144 144
145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); 145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds));
146 mTimeBox->adjustSize(); 146 mTimeBox->adjustSize();
147 // the -2 below is there because there is a bug in this program 147 // the -2 below is there because there is a bug in this program
148 // somewhere, where the last column of this widget is a few pixels 148 // somewhere, where the last column of this widget is a few pixels
149 // narrower than the other columns. 149 // narrower than the other columns.
150 int offs = (today==agenda->columns()-1) ? -4 : 0; 150 int offs = (today==agenda->columns()-1) ? -4 : 0;
151 agenda->moveChild(mTimeBox, 151 agenda->moveChild(mTimeBox,
152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
153 y-mTimeBox->height()); 153 y-mTimeBox->height());
154
155 mTimeBox->raise(); 154 mTimeBox->raise();
156 //mTimeBox->setAutoMask(true); 155 //mTimeBox->setAutoMask(true);
157 minutes->start(5000,true); 156 int secs = QTime::currentTime().second();
157 qDebug("second %d ", secs );
158 minutes->start( (60 - secs +1)*1000 ,true);
158} 159}
159 160
160 161
161//////////////////////////////////////////////////////////////////////////// 162////////////////////////////////////////////////////////////////////////////
162 163
163 164
164/* 165/*
165 Create an agenda widget with rows rows and columns columns. 166 Create an agenda widget with rows rows and columns columns.
166*/ 167*/
167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 168KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
168 const char *name,WFlags f) : 169 const char *name,WFlags f) :
169 QScrollView(parent,name,f) 170 QScrollView(parent,name,f)
@@ -433,25 +434,25 @@ void KOAgenda::categoryChanged(Incidence * inc)
433 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 434 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
434 if ( item->incidence() == inc ) { 435 if ( item->incidence() == inc ) {
435 item->initColor (); 436 item->initColor ();
436 item->updateItem(); 437 item->updateItem();
437 } 438 }
438 } 439 }
439} 440}
440bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) 441bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
441{ 442{
442 443
443 if ( mInvalidPixmap ) { 444 if ( mInvalidPixmap ) {
444 mInvalidPixmap = false; 445 mInvalidPixmap = false;
445 qDebug("InvalidPixmap "); 446 qDebug("KO: Upsizing Pixmaps ");
446 computeSizes(); 447 computeSizes();
447 emit updateViewSignal(); 448 emit updateViewSignal();
448 return true; 449 return true;
449 } 450 }
450 emit sendPing(); 451 emit sendPing();
451 static int startX = 0; 452 static int startX = 0;
452 static int startY = 0; 453 static int startY = 0;
453 int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); 454 int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 );
454 static bool blockMoving = true; 455 static bool blockMoving = true;
455 456
456 //qDebug("KOAgenda::eventFilter_mous "); 457 //qDebug("KOAgenda::eventFilter_mous ");
457 if ( object == mNewItemPopup ) { 458 if ( object == mNewItemPopup ) {
@@ -1267,25 +1268,25 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1267// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1268// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1268// } 1269// }
1269// placeItem->updateItem(); 1270// placeItem->updateItem();
1270} 1271}
1271 1272
1272void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1273void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1273{ 1274{
1274 if ( globalFlagBlockAgenda ) 1275 if ( globalFlagBlockAgenda )
1275 return; 1276 return;
1276 1277
1277 if ( mInvalidPixmap ) { 1278 if ( mInvalidPixmap ) {
1278 mInvalidPixmap = false; 1279 mInvalidPixmap = false;
1279 qDebug("InvalidPixmap "); 1280 qDebug("KO: Upsizing Pixmaps ");
1280 computeSizes(); 1281 computeSizes();
1281 emit updateViewSignal(); 1282 emit updateViewSignal();
1282 return; 1283 return;
1283 } 1284 }
1284 if ( ! mAllDayMode ) { 1285 if ( ! mAllDayMode ) {
1285 // currently not working for 1286 // currently not working for
1286 1287
1287 //qDebug("KOAgenda::drawContents "); 1288 //qDebug("KOAgenda::drawContents ");
1288#if 0 1289#if 0
1289 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { 1290 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
1290 qDebug("WAU "); 1291 qDebug("WAU ");
1291 drawContentsToPainter(); 1292 drawContentsToPainter();
@@ -1408,25 +1409,25 @@ void KOAgenda::finishUpdate()
1408 1409
1409 } 1410 }
1410 globalFlagBlockAgendaItemUpdate = 0; 1411 globalFlagBlockAgendaItemUpdate = 0;
1411 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1412 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1412 item->repaintMe( ); 1413 item->repaintMe( );
1413 } 1414 }
1414 globalFlagBlockAgendaItemUpdate = 1; 1415 globalFlagBlockAgendaItemUpdate = 1;
1415 qApp->processEvents(); 1416 qApp->processEvents();
1416 globalFlagBlockAgendaItemPaint = 0; 1417 globalFlagBlockAgendaItemPaint = 0;
1417 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1418 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1418 item->repaint( false ); 1419 item->repaint( false );
1419 } 1420 }
1420 1421 marcus_bains();
1421} 1422}
1422 1423
1423/* 1424/*
1424 Draw grid in the background of the agenda. 1425 Draw grid in the background of the agenda.
1425*/ 1426*/
1426void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1427void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1427{ 1428{
1428 1429
1429 1430
1430 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1431 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1431 return; 1432 return;
1432 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1433 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
@@ -1791,25 +1792,24 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int
1791 1792
1792 agendaItem->resize(mGridSpacingX,iheight ); 1793 agendaItem->resize(mGridSpacingX,iheight );
1793 agendaItem->setCellXY(X,YTop,YBottom); 1794 agendaItem->setCellXY(X,YTop,YBottom);
1794 agendaItem->setCellXWidth(X); 1795 agendaItem->setCellXWidth(X);
1795 1796
1796 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); 1797 //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY);
1797 mItems.append(agendaItem); 1798 mItems.append(agendaItem);
1798 1799
1799 placeSubCells(agendaItem); 1800 placeSubCells(agendaItem);
1800 1801
1801 //agendaItem->show(); 1802 //agendaItem->show();
1802 1803
1803 marcus_bains();
1804 1804
1805 return agendaItem; 1805 return agendaItem;
1806} 1806}
1807 1807
1808 1808
1809/* 1809/*
1810 Insert all-day KOAgendaItem into agenda. 1810 Insert all-day KOAgendaItem into agenda.
1811*/ 1811*/
1812KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) 1812KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd)
1813{ 1813{
1814 if (!mAllDayMode) { 1814 if (!mAllDayMode) {
1815 return 0; 1815 return 0;
@@ -1864,26 +1864,24 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
1864 KOAgendaItem *setFirst,*setLast; 1864 KOAgendaItem *setFirst,*setLast;
1865 current = first; 1865 current = first;
1866 while (current) { 1866 while (current) {
1867 next = multiItems.next(); 1867 next = multiItems.next();
1868 if (current == first) setFirst = 0; 1868 if (current == first) setFirst = 0;
1869 else setFirst = first; 1869 else setFirst = first;
1870 if (current == last) setLast = 0; 1870 if (current == last) setLast = 0;
1871 else setLast = last; 1871 else setLast = last;
1872 1872
1873 current->setMultiItem(setFirst,next,setLast); 1873 current->setMultiItem(setFirst,next,setLast);
1874 current = next; 1874 current = next;
1875 } 1875 }
1876
1877 marcus_bains();
1878} 1876}
1879 1877
1880 1878
1881//QSizePolicy KOAgenda::sizePolicy() const 1879//QSizePolicy KOAgenda::sizePolicy() const
1882//{ 1880//{
1883 // Thought this would make the all-day event agenda minimum size and the 1881 // Thought this would make the all-day event agenda minimum size and the
1884 // normal agenda take the remaining space. But it doesn´t work. The QSplitter 1882 // normal agenda take the remaining space. But it doesn´t work. The QSplitter
1885 // don´t seem to think that an Expanding widget needs more space than a 1883 // don´t seem to think that an Expanding widget needs more space than a
1886 // Preferred one. 1884 // Preferred one.
1887 // But it doesn´t hurt, so it stays. 1885 // But it doesn´t hurt, so it stays.
1888// if (mAllDayMode) { 1886// if (mAllDayMode) {
1889// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); 1887// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
@@ -1950,37 +1948,36 @@ void KOAgenda::computeSizes()
1950 item->resize(subCellWidth,item->height()); 1948 item->resize(subCellWidth,item->height());
1951 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1949 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1952 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1950 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1953 item->cellX() * mGridSpacingX) + 1951 item->cellX() * mGridSpacingX) +
1954 item->subCell() * subCellWidth,childY(item)); 1952 item->subCell() * subCellWidth,childY(item));
1955 } 1953 }
1956 } 1954 }
1957 int cw = contentsWidth(); 1955 int cw = contentsWidth();
1958 int ch = contentsHeight(); 1956 int ch = contentsHeight();
1959 if ( mAllDayMode ) { 1957 if ( mAllDayMode ) {
1960 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1958 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1961 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { 1959 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) {
1962 qDebug("paintPixAll->resize "); 1960 //qDebug("paintPixAll->resize ");
1963 paintPixAll->resize( cw, ch ); 1961 paintPixAll->resize( cw, ch );
1964 } 1962 }
1965 } else { 1963 } else {
1966 QPixmap* paintPix = KOAgendaItem::paintPix(); 1964 QPixmap* paintPix = KOAgendaItem::paintPix();
1967 if ( paintPix->width() < cw || paintPix->height() < ch ) { 1965 if ( paintPix->width() < cw || paintPix->height() < ch ) {
1968 qDebug("paintPix->resize "); 1966 //qDebug("paintPix->resize ");
1969 paintPix->resize( cw , ch ); 1967 paintPix->resize( cw , ch );
1970 } 1968 }
1971 } 1969 }
1972 1970
1973 checkScrollBoundaries(); 1971 checkScrollBoundaries();
1974 marcus_bains();
1975 drawContentsToPainter(); 1972 drawContentsToPainter();
1976 viewport()->repaint(false); 1973 viewport()->repaint(false);
1977} 1974}
1978 1975
1979void KOAgenda::scrollUp() 1976void KOAgenda::scrollUp()
1980{ 1977{
1981 scrollBy(0,-mScrollOffset); 1978 scrollBy(0,-mScrollOffset);
1982} 1979}
1983 1980
1984 1981
1985void KOAgenda::scrollDown() 1982void KOAgenda::scrollDown()
1986{ 1983{
@@ -2022,25 +2019,24 @@ void KOAgenda::updateConfig()
2022 if ( mAllDayMode ) { 2019 if ( mAllDayMode ) {
2023 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; 2020 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize;
2024 //mGridSpacingY = KOPrefs::instance()->mAllDaySize; 2021 //mGridSpacingY = KOPrefs::instance()->mAllDaySize;
2025 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); 2022 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 );
2026 // setMaximumHeight( mGridSpacingY+1 ); 2023 // setMaximumHeight( mGridSpacingY+1 );
2027 viewport()->repaint( false ); 2024 viewport()->repaint( false );
2028 //setFixedHeight( mGridSpacingY+1 ); 2025 //setFixedHeight( mGridSpacingY+1 );
2029 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); 2026 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize);
2030 } 2027 }
2031 else { 2028 else {
2032 mGridSpacingY = KOPrefs::instance()->mHourSize; 2029 mGridSpacingY = KOPrefs::instance()->mHourSize;
2033 calculateWorkingHours(); 2030 calculateWorkingHours();
2034 marcus_bains();
2035 } 2031 }
2036} 2032}
2037 2033
2038void KOAgenda::checkScrollBoundaries() 2034void KOAgenda::checkScrollBoundaries()
2039{ 2035{
2040 // Invalidate old values to force update 2036 // Invalidate old values to force update
2041 mOldLowerScrollValue = -1; 2037 mOldLowerScrollValue = -1;
2042 mOldUpperScrollValue = -1; 2038 mOldUpperScrollValue = -1;
2043 2039
2044 checkScrollBoundaries(verticalScrollBar()->value()); 2040 checkScrollBoundaries(verticalScrollBar()->value());
2045} 2041}
2046 2042
@@ -2115,25 +2111,24 @@ void KOAgenda::calculateWorkingHours()
2115 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; 2111 KOPrefs::instance()->mWorkingHoursEnd * 4 - 1;
2116} 2112}
2117 2113
2118 2114
2119DateList KOAgenda::dateList() const 2115DateList KOAgenda::dateList() const
2120{ 2116{
2121 return mSelectedDates; 2117 return mSelectedDates;
2122} 2118}
2123 2119
2124void KOAgenda::setDateList(const DateList &selectedDates) 2120void KOAgenda::setDateList(const DateList &selectedDates)
2125{ 2121{
2126 mSelectedDates = selectedDates; 2122 mSelectedDates = selectedDates;
2127 marcus_bains();
2128} 2123}
2129 2124
2130void KOAgenda::setHolidayMask(QMemArray<bool> *mask) 2125void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
2131{ 2126{
2132 mHolidayMask = mask; 2127 mHolidayMask = mask;
2133 2128
2134/* 2129/*
2135 kdDebug() << "HolidayMask: "; 2130 kdDebug() << "HolidayMask: ";
2136 for(uint i=0;i<mask->count();++i) { 2131 for(uint i=0;i<mask->count();++i) {
2137 kdDebug() << (mask->at(i) ? "*" : "o"); 2132 kdDebug() << (mask->at(i) ? "*" : "o");
2138 } 2133 }
2139 kdDebug() << endl; 2134 kdDebug() << endl;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1b21a71..ef5c4dd 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -67,25 +67,25 @@
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79#define IDLETIMEOUT 15 79#define IDLETIMEOUT 45
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 myPix.resize( 1, 1 ); 84 myPix.resize( 1, 1 );
85 mRows = rows; 85 mRows = rows;
86 86
87 mRedrawNeeded = true; 87 mRedrawNeeded = true;
88 setMinimumHeight( 20 ); 88 setMinimumHeight( 20 );
89 mCellHeight = KOPrefs::instance()->mHourSize*4; 89 mCellHeight = KOPrefs::instance()->mHourSize*4;
90 90
91 enableClipper(true); 91 enableClipper(true);
@@ -564,57 +564,60 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
564 SIGNAL( incidenceSelected( Incidence * ) ) ); 564 SIGNAL( incidenceSelected( Incidence * ) ) );
565 connect( mAgenda, SIGNAL( resizedSignal() ), 565 connect( mAgenda, SIGNAL( resizedSignal() ),
566 SLOT( updateConfig( ) ) ); 566 SLOT( updateConfig( ) ) );
567 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 567 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
568 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 568 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
569 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 569 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
570 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 570 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
571 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 571 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
572 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 572 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
573 573
574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); 574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); 575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
576#ifndef DESKTOP_VERSION
576 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); 577 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) );
577 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); 578 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) );
578
579 connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) ); 579 connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) );
580 connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) ); 580 connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) );
581
582
583 mIdleTimer = new QTimer ( this );; 581 mIdleTimer = new QTimer ( this );;
584 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); 582 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
583#endif
585} 584}
586void KOAgendaView::startIdleTimeout() 585void KOAgendaView::startIdleTimeout()
587{ 586{
587#ifndef DESKTOP_VERSION
588 mIdleStart = QDateTime::currentDateTime(); 588 mIdleStart = QDateTime::currentDateTime();
589 mIdleTimer->start( IDLETIMEOUT * 1000 ); 589 mIdleTimer->start( IDLETIMEOUT * 1000 );
590#endif
590} 591}
591void KOAgendaView::slotIdleTimeout() 592void KOAgendaView::slotIdleTimeout()
592{ 593{
593 qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); 594#ifndef DESKTOP_VERSION
595 //qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) );
594 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); 596 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() );
595 mIdleTimer->stop(); 597 mIdleTimer->stop();
596 bool isActice = topLevelWidget()->isActiveWindow(); 598 bool isActice = topLevelWidget()->isActiveWindow();
597 qDebug("KO: Active Window %d %d", isActice, isVisible()); 599 //qDebug("KO: Active Window %d %d", isActice, isVisible());
598 // we do nothing if we wake up from a suspend 600 // we do nothing if we wake up from a suspend
599 if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { 601 if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) {
600 qDebug("KO: Wakeup from suspend "); 602 qDebug("KO: Wakeup from suspend ");
601 startIdleTimeout(); 603 startIdleTimeout();
602 return; 604 return;
603 } 605 }
604 qDebug("KO: Downsizing Pixmaps "); 606 qDebug("KO: Downsizing Pixmaps ");
605 mAgenda->shrinkPixmap(); 607 mAgenda->shrinkPixmap();
606 mAllDayAgenda->shrinkPixmap(); 608 mAllDayAgenda->shrinkPixmap();
607 KOAgendaItem::paintPix()->resize( 20,20); 609 KOAgendaItem::paintPix()->resize( 20,20);
608 KOAgendaItem::paintPixAllday()->resize( 20,20); 610 KOAgendaItem::paintPixAllday()->resize( 20,20);
611#endif
609 612
610} 613}
611void KOAgendaView::toggleAllDay() 614void KOAgendaView::toggleAllDay()
612{ 615{
613 if ( mSplitterAgenda->firstHandle() ) 616 if ( mSplitterAgenda->firstHandle() )
614 mSplitterAgenda->firstHandle()->toggle(); 617 mSplitterAgenda->firstHandle()->toggle();
615} 618}
616void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 619void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
617{ 620{
618 calendar()->addIncidence( inc ); 621 calendar()->addIncidence( inc );
619 622
620 if ( incOld ) { 623 if ( incOld ) {
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index ff80afc..7ce3f1f 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -28,24 +28,25 @@
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32 32
33 33
34#include <libkcal/calfilter.h> 34#include <libkcal/calfilter.h>
35 35
36#include "kofilterview.h" 36#include "kofilterview.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <kglobalsettings.h>
40#include <kcolorbutton.h> 41#include <kcolorbutton.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42 43
43 44
44 45
45 46
46 47
47KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 48KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
48 const char* name,WFlags fl ) 49 const char* name,WFlags fl )
49 : KOFilterView_base(parent,name,fl) 50 : KOFilterView_base(parent,name,fl)
50{ 51{
51 mFilters = filterList; 52 mFilters = filterList;
@@ -389,41 +390,57 @@ void KOCalEditView::addCal()
389 break; 390 break;
390 } 391 }
391 kkf = KOPrefs::instance()->mCalendars.next(); 392 kkf = KOPrefs::instance()->mCalendars.next();
392 } 393 }
393 } 394 }
394 addCalendar ( name, file ); 395 addCalendar ( name, file );
395 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 396 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
396} 397}
397int KOCalEditView::addCalendar( QString name, QString file, bool ask ) 398int KOCalEditView::addCalendar( QString name, QString file, bool ask )
398{ 399{
399 400
400 QFileInfo fi ( file ); 401 QFileInfo fi ( file );
402 QString absFile = file;
403 bool isRelative = false;
404 if ( fi.isRelative() ) {
405 isRelative = true;
406 absFile = KGlobalSettings::calendarDir()+file;
407 fi.setFile( absFile );
408 } else {
409 QString cd = KGlobalSettings::calendarDir();
410 if ( file.left( cd.length() ) == cd ) {
411 isRelative = true;
412 file = fi.fileName ();
413 fi.setFile( absFile );
414 }
415 }
401 if (!fi.exists() ) { 416 if (!fi.exists() ) {
402 if ( ask ) 417 if ( ask )
403 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 418 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No )
404 return 0; 419 return 0;
405 QFile fileIn( file ); 420 QFile fileIn( absFile );
406 if (!fileIn.open( IO_WriteOnly ) ) { 421 if (!fileIn.open( IO_WriteOnly ) ) {
407 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 422 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
408 return 0; 423 return 0;
409 } 424 }
410 QTextStream tsIn( &fileIn ); 425 QTextStream tsIn( &fileIn );
411 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 426 tsIn.setCodec( QTextCodec::codecForName("utf8") );
412 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 427 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
413 fileIn.close(); 428 fileIn.close();
414 } 429 }
415 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 430 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
416 kkf->mName = name; 431 kkf->mName = name;
417 kkf->mFileName = file; 432 kkf->mFileName = absFile;
433 kkf->mSavedFileName = file;
434 kkf->isRelative = isRelative;
418 emit calendarAdded( kkf->mCalNumber ); 435 emit calendarAdded( kkf->mCalNumber );
419 if ( ask ) 436 if ( ask )
420 emit needsUpdate(); 437 emit needsUpdate();
421 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 438 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
422 return kkf->mCalNumber; 439 return kkf->mCalNumber;
423} 440}
424int KOCalEditView::getBirtdayID() 441int KOCalEditView::getBirtdayID()
425{ 442{
426 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 443 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
427 while ( kkf ) { 444 while ( kkf ) {
428 if ( kkf->mName == i18n("Birthdays") ) 445 if ( kkf->mName == i18n("Birthdays") )
429 return kkf->mCalNumber; 446 return kkf->mCalNumber;
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 4322299..be7b5b6 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -80,24 +80,25 @@ class KONewCalPrefs : public QDialog
80 QString calName() { return nameE->text(); } 80 QString calName() { return nameE->text(); }
81 QString calFileName() { return url->url(); } 81 QString calFileName() { return url->url(); }
82 82
83public slots: 83public slots:
84void checkValid() { 84void checkValid() {
85 if ( nameE->text().isEmpty() ) { 85 if ( nameE->text().isEmpty() ) {
86 KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); 86 KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") );
87 nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); 87 nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () ));
88 return; 88 return;
89 } 89 }
90 if ( url->url().isEmpty() ) { 90 if ( url->url().isEmpty() ) {
91 KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); 91 KMessageBox::information( this, i18n("Sorry, the file name is empty!") );
92 url->setURL( nameE->text() + ".ics" );
92 return; 93 return;
93 } 94 }
94 accept(); 95 accept();
95} 96}
96 97
97public: 98public:
98 KLineEdit* nameE; 99 KLineEdit* nameE;
99 KURLRequester *url; 100 KURLRequester *url;
100}; 101};
101 102
102class KOCalButton : public QPushButton 103class KOCalButton : public QPushButton
103{ 104{
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a886735..f1f1442 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -445,36 +445,40 @@ void KOPrefs::usrReadConfig()
445 if ( numCals == 0 ) { 445 if ( numCals == 0 ) {
446 KopiCalendarFile *kkf = getNewCalendar(); 446 KopiCalendarFile *kkf = getNewCalendar();
447 kkf->isStandard = true; 447 kkf->isStandard = true;
448 kkf->mName = i18n("Standard"); 448 kkf->mName = i18n("Standard");
449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
450 } 450 }
451 while ( mNextAvailableCalendar <= numCals ) { 451 while ( mNextAvailableCalendar <= numCals ) {
452 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 452 //qDebug("Read cal #%d ", mNextAvailableCalendar );
453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
454 KopiCalendarFile *kkf = getNewCalendar(); 454 KopiCalendarFile *kkf = getNewCalendar();
455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
457 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false );
457 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 458 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
458 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 459 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
459 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 460 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
460 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 461 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
462 kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName);
461 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 463 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
462 if ( kkf->mCalNumber == 1 ) { 464 if ( kkf->mCalNumber == 1 ) {
463 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 465 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
464 } 466 }
465 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 467 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
466 if ( kkf->mName == i18n("Birthdays") ) { 468 if ( kkf->mName == i18n("Birthdays") ) {
467 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 469 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
468 } 470 }
471 if ( kkf->isRelative )
472 kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName;
469 } 473 }
470 474
471 KPimPrefs::usrReadConfig(); 475 KPimPrefs::usrReadConfig();
472} 476}
473 477
474KopiCalendarFile * KOPrefs::getCalendar( int num ) 478KopiCalendarFile * KOPrefs::getCalendar( int num )
475{ 479{
476 return mDefCalColors[num-1]; 480 return mDefCalColors[num-1];
477} 481}
478 482
479KopiCalendarFile * KOPrefs::getNewCalendar() 483KopiCalendarFile * KOPrefs::getNewCalendar()
480{ 484{
@@ -543,26 +547,28 @@ void KOPrefs::usrWriteConfig()
543 while ( numCal < mNextAvailableCalendar ) { 547 while ( numCal < mNextAvailableCalendar ) {
544 KopiCalendarFile * kkf = mCalendars.first(); 548 KopiCalendarFile * kkf = mCalendars.first();
545 while ( kkf ) { 549 while ( kkf ) {
546 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 550 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
547 if ( kkf->mCalNumber == numCal ) { 551 if ( kkf->mCalNumber == numCal ) {
548 ++writeCal; 552 ++writeCal;
549 //qDebug("Write calendar %d %d ", numCal , writeCal); 553 //qDebug("Write calendar %d %d ", numCal , writeCal);
550 QString prefix = "Cal_" + QString::number( writeCal ); 554 QString prefix = "Cal_" + QString::number( writeCal );
551 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 555 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
552 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 556 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
553 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 557 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
554 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 558 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
559 fc.writeEntry( prefix+"_isRelative", kkf->isRelative );
555 fc.writeEntry( prefix+"_Name", kkf->mName); 560 fc.writeEntry( prefix+"_Name", kkf->mName);
556 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 561 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
562 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName);
557 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 563 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
558 } 564 }
559 kkf = mCalendars.next(); 565 kkf = mCalendars.next();
560 } 566 }
561 ++numCal; 567 ++numCal;
562 } 568 }
563 fc.sync(); 569 fc.sync();
564 KPimPrefs::usrWriteConfig(); 570 KPimPrefs::usrWriteConfig();
565} 571}
566 572
567void KOPrefs::setCategoryColor(QString cat,const QColor & color) 573void KOPrefs::setCategoryColor(QString cat,const QColor & color)
568{ 574{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 7ec5327..0779e27 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -45,35 +45,39 @@ class QStringList;
45 45
46class KopiCalendarFile : public QObject 46class KopiCalendarFile : public QObject
47{ 47{
48 public: 48 public:
49 KopiCalendarFile( ) : QObject( ) 49 KopiCalendarFile( ) : QObject( )
50 { 50 {
51 isStandard = false; 51 isStandard = false;
52 isEnabled = true; 52 isEnabled = true;
53 isAlarmEnabled = true; 53 isAlarmEnabled = true;
54 isReadOnly = false; 54 isReadOnly = false;
55 mName = "Calendar"; 55 mName = "Calendar";
56 mFileName = QDir::homeDirPath() + "/icalfile.ics"; 56 mFileName = QDir::homeDirPath() + "/icalfile.ics";
57 mSavedFileName = "icalfile.ics";
57 mCalNumber = 0; 58 mCalNumber = 0;
58 mDefaultColor = Qt::red; 59 mDefaultColor = Qt::red;
59 mErrorOnLoad = false; 60 mErrorOnLoad = false;
61 isRelative = false;
60 } 62 }
61 bool isStandard; 63 bool isStandard;
62 bool isEnabled; 64 bool isEnabled;
63 bool isAlarmEnabled; 65 bool isAlarmEnabled;
64 bool isReadOnly; 66 bool isReadOnly;
65 bool mErrorOnLoad; 67 bool mErrorOnLoad;
66 QString mName; 68 QString mName;
67 QString mFileName; 69 QString mFileName;
70 QString mSavedFileName;
71 bool isRelative;
68 int mCalNumber; 72 int mCalNumber;
69 QColor mDefaultColor; 73 QColor mDefaultColor;
70 QDateTime mLoadDt; 74 QDateTime mLoadDt;
71}; 75};
72class KOPrefs : public KPimPrefs 76class KOPrefs : public KPimPrefs
73{ 77{
74 public: 78 public:
75 enum { FormatVCalendar, FormatICalendar }; 79 enum { FormatVCalendar, FormatICalendar };
76 enum { MailClientKMail, MailClientSendmail }; 80 enum { MailClientKMail, MailClientSendmail };
77 enum { IMIPDummy, IMIPKMail }; 81 enum { IMIPDummy, IMIPKMail };
78 enum { IMIPOutbox, IMIPdirectsend }; 82 enum { IMIPOutbox, IMIPdirectsend };
79 enum { neverAuto, addressbookAuto, selectedAuto }; 83 enum { neverAuto, addressbookAuto, selectedAuto };