summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp4
-rw-r--r--korganizer/koagenda.cpp6
-rw-r--r--korganizer/koagenda.h2
-rw-r--r--korganizer/kotodoview.cpp4
4 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 5fc3f2f..7f6f221 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -229,49 +229,51 @@ void JournalEntry::fillCalendar( int setToID )
229{ 229{
230 mCalendarBox->clear(); 230 mCalendarBox->clear();
231 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 231 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
232 int std = 0; 232 int std = 0;
233 int count = 0; 233 int count = 0;
234 while ( kkf ) { 234 while ( kkf ) {
235 if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { 235 if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) {
236 if ( setToID ) { 236 if ( setToID ) {
237 if ( kkf->mCalNumber == setToID ) 237 if ( kkf->mCalNumber == setToID )
238 std = count; 238 std = count;
239 } else { 239 } else {
240 if ( kkf->isStandard ) { 240 if ( kkf->isStandard ) {
241 std = count; 241 std = count;
242 } 242 }
243 } 243 }
244 ++count; 244 ++count;
245 mCalendarBox->insertItem( kkf->mName ); 245 mCalendarBox->insertItem( kkf->mName );
246 } 246 }
247 kkf = KOPrefs::instance()->mCalendars.next(); 247 kkf = KOPrefs::instance()->mCalendars.next();
248 } 248 }
249 mCalendarBox->setCurrentItem( std ); 249 mCalendarBox->setCurrentItem( std );
250} 250}
251 251
252void JournalEntry::toggleShowJournal() 252void JournalEntry::toggleShowJournal()
253{ 253{
254 if ( mEditor->text().isEmpty() && mTitle->currentText ().isEmpty() )
255 return;
254 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) 256 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty())
255 flushEntry(); 257 flushEntry();
256 if ( showOnlyMode ) 258 if ( showOnlyMode )
257 emit showJournalOnly( 0 ); 259 emit showJournalOnly( 0 );
258 else { 260 else {
259 // we have to protect mJournal from deleting if mJournal has empty text 261 // we have to protect mJournal from deleting if mJournal has empty text
260 visibleMode = false; // set to true via :setShowOnly() 262 visibleMode = false; // set to true via :setShowOnly()
261 emit showJournalOnly( mJournal ); 263 emit showJournalOnly( mJournal );
262 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); 264 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) );
263 } 265 }
264} 266}
265void JournalEntry::setVisibleOn() 267void JournalEntry::setVisibleOn()
266{ 268{
267 visibleMode = true; 269 visibleMode = true;
268} 270}
269void JournalEntry::setShowOnly() 271void JournalEntry::setShowOnly()
270{ 272{
271 showOnlyMode = true; 273 showOnlyMode = true;
272 if ( mTitle->currentText().isEmpty() ) 274 if ( mTitle->currentText().isEmpty() )
273 mTitle->setFocus(); 275 mTitle->setFocus();
274 else 276 else
275 mEditor->setFocus(); 277 mEditor->setFocus();
276} 278}
277void JournalEntry::setJournal(Journal *journal, bool saveJournal ) 279void JournalEntry::setJournal(Journal *journal, bool saveJournal )
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index c738f7e..7e9fa71 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -66,49 +66,52 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
66 : QFrame(_agenda->viewport(),name), agenda(_agenda) 66 : QFrame(_agenda->viewport(),name), agenda(_agenda)
67{ 67{
68 setLineWidth(0); 68 setLineWidth(0);
69 setMargin(0); 69 setMargin(0);
70 setBackgroundColor(Qt::red); 70 setBackgroundColor(Qt::red);
71 minutes = new QTimer(this); 71 minutes = new QTimer(this);
72 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); 72 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
73 minutes->start(0, true); 73 minutes->start(0, true);
74 mTimeBox = new QLabel(this); 74 mTimeBox = new QLabel(this);
75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); 75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
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 90void MarcusBains::hideMe()
91{
92 hide(); mTimeBox->hide();
93}
91int MarcusBains::todayColumn() 94int MarcusBains::todayColumn()
92{ 95{
93 QDate currentDate = QDate::currentDate(); 96 QDate currentDate = QDate::currentDate();
94 97
95 DateList dateList = agenda->dateList(); 98 DateList dateList = agenda->dateList();
96 DateList::ConstIterator it; 99 DateList::ConstIterator it;
97 int col = 0; 100 int col = 0;
98 for(it = dateList.begin(); it != dateList.end(); ++it) { 101 for(it = dateList.begin(); it != dateList.end(); ++it) {
99 if((*it) == currentDate) 102 if((*it) == currentDate)
100 return KOGlobals::self()->reverseLayout() ? 103 return KOGlobals::self()->reverseLayout() ?
101 agenda->columns() - 1 - col : col; 104 agenda->columns() - 1 - col : col;
102 ++col; 105 ++col;
103 } 106 }
104 107
105 return -1; 108 return -1;
106} 109}
107void MarcusBains::updateLoc() 110void MarcusBains::updateLoc()
108{ 111{
109 updateLocation(); 112 updateLocation();
110} 113}
111void MarcusBains::updateLocation(bool recalculate) 114void MarcusBains::updateLocation(bool recalculate)
112{ 115{
113 116
114 QTime tim = QTime::currentTime(); 117 QTime tim = QTime::currentTime();
@@ -351,48 +354,49 @@ void KOAgenda::clear()
351} 354}
352 355
353void KOAgenda::clearSelection() 356void KOAgenda::clearSelection()
354{ 357{
355 mSelectionCellX = 0; 358 mSelectionCellX = 0;
356 mSelectionYTop = 0; 359 mSelectionYTop = 0;
357 mSelectionHeight = 0; 360 mSelectionHeight = 0;
358} 361}
359 362
360void KOAgenda::marcus_bains() 363void KOAgenda::marcus_bains()
361{ 364{
362 if(mMarcusBains) mMarcusBains->updateLocation(true); 365 if(mMarcusBains) mMarcusBains->updateLocation(true);
363} 366}
364 367
365 368
366void KOAgenda::changeColumns(int columns) 369void KOAgenda::changeColumns(int columns)
367{ 370{
368 if (columns == 0) { 371 if (columns == 0) {
369 qDebug("KOAgenda::changeColumns() called with argument 0 "); 372 qDebug("KOAgenda::changeColumns() called with argument 0 ");
370 return; 373 return;
371 } 374 }
372 clear(); 375 clear();
373 mColumns = columns; 376 mColumns = columns;
374 computeSizes(); 377 computeSizes();
378 if(mMarcusBains) mMarcusBains->hideMe();
375} 379}
376 380
377/* 381/*
378 This is the eventFilter function, which gets all events from the KOAgendaItems 382 This is the eventFilter function, which gets all events from the KOAgendaItems
379 contained in the agenda. It has to handle moving and resizing for all items. 383 contained in the agenda. It has to handle moving and resizing for all items.
380*/ 384*/
381bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) 385bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
382{ 386{
383 // kdDebug() << "KOAgenda::eventFilter" << endl; 387 // kdDebug() << "KOAgenda::eventFilter" << endl;
384 switch(event->type()) { 388 switch(event->type()) {
385 case QEvent::MouseButtonPress: 389 case QEvent::MouseButtonPress:
386 case QEvent::MouseButtonDblClick: 390 case QEvent::MouseButtonDblClick:
387 case QEvent::MouseButtonRelease: 391 case QEvent::MouseButtonRelease:
388 case QEvent::MouseMove: 392 case QEvent::MouseMove:
389 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); 393 return eventFilter_mouse(object, static_cast<QMouseEvent *>(event));
390 394
391 case (QEvent::Leave): 395 case (QEvent::Leave):
392 if (!mActionItem) 396 if (!mActionItem)
393 setCursor(arrowCursor); 397 setCursor(arrowCursor);
394 return true; 398 return true;
395 399
396 default: 400 default:
397 return QScrollView::eventFilter(object,event); 401 return QScrollView::eventFilter(object,event);
398 } 402 }
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 86cf2f4..59e7472 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -27,49 +27,49 @@
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qmemarray.h> 28#include <qmemarray.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qguardedptr.h>
32 32
33#include "koagendaitem.h" 33#include "koagendaitem.h"
34#include "koeventview.h" 34#include "koeventview.h"
35 35
36class QPopupMenu; 36class QPopupMenu;
37class QTime; 37class QTime;
38class KConfig; 38class KConfig;
39class QFrame; 39class QFrame;
40class KOAgenda; 40class KOAgenda;
41class KCal::Event; 41class KCal::Event;
42class KCal::Todo; 42class KCal::Todo;
43 43
44using namespace KCal; 44using namespace KCal;
45 45
46class MarcusBains : public QFrame { 46class MarcusBains : public QFrame {
47 Q_OBJECT 47 Q_OBJECT
48 public: 48 public:
49 MarcusBains(KOAgenda *agenda=0,const char *name=0); 49 MarcusBains(KOAgenda *agenda=0,const char *name=0);
50 virtual ~MarcusBains(); 50 virtual ~MarcusBains();
51 51 void hideMe();
52 public slots: 52 public slots:
53 void updateLocation(bool recalculate=false); 53 void updateLocation(bool recalculate=false);
54 void updateLoc(); 54 void updateLoc();
55 55
56 private: 56 private:
57 int todayColumn(); 57 int todayColumn();
58 QTimer *minutes; 58 QTimer *minutes;
59 QLabel *mTimeBox; 59 QLabel *mTimeBox;
60 KOAgenda *agenda; 60 KOAgenda *agenda;
61 QTime oldTime; 61 QTime oldTime;
62 int oldToday; 62 int oldToday;
63}; 63};
64 64
65 65
66class KOAgenda : public QScrollView 66class KOAgenda : public QScrollView
67{ 67{
68 Q_OBJECT 68 Q_OBJECT
69 public: 69 public:
70 enum MouseActionType { NOP, MOVE, SELECT, 70 enum MouseActionType { NOP, MOVE, SELECT,
71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
72 72
73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
74 const char * name=0, WFlags f=0 ); 74 const char * name=0, WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 75 KOAgenda ( int columns, QWidget * parent=0,
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index f46a103..82c0f4c 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1336,66 +1336,66 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1336 } 1336 }
1337 } 1337 }
1338 } 1338 }
1339 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1339 if ( KOPrefs::instance()->mEditOnDoubleClick )
1340 editItem( item ); 1340 editItem( item );
1341 else 1341 else
1342 showItem( item , QPoint(), 0 ); 1342 showItem( item , QPoint(), 0 );
1343} 1343}
1344void KOTodoView::toggleRunningItem() 1344void KOTodoView::toggleRunningItem()
1345{ 1345{
1346 // qDebug("KOTodoView::toggleRunning() "); 1346 // qDebug("KOTodoView::toggleRunning() ");
1347 if ( ! mActiveItem ) 1347 if ( ! mActiveItem )
1348 return; 1348 return;
1349 Todo * t = mActiveItem->todo(); 1349 Todo * t = mActiveItem->todo();
1350 if ( t->isRunning() ) { 1350 if ( t->isRunning() ) {
1351 KOStopTodoPrefs tp ( t, this ); 1351 KOStopTodoPrefs tp ( t, this );
1352 if (QApplication::desktop()->width() <= 800 ){ 1352 if (QApplication::desktop()->width() <= 800 ){
1353 int wid = tp.width(); 1353 int wid = tp.width();
1354 int hei = tp.height(); 1354 int hei = tp.height();
1355 int xx = (QApplication::desktop()->width()-wid)/2; 1355 int xx = (QApplication::desktop()->width()-wid)/2;
1356 int yy = (QApplication::desktop()->height()-hei)/2; 1356 int yy = (QApplication::desktop()->height()-hei)/2;
1357 tp.setGeometry( xx,yy,wid,hei ); 1357 tp.setGeometry( xx,yy,wid,hei );
1358 } 1358 }
1359 tp.exec(); 1359 tp.exec();
1360 mActiveItem->construct(); 1360 updateTodo ( t, 0 );
1361 } else { 1361 } else {
1362 KOStartTodoPrefs tp ( t->summary(), this ); 1362 KOStartTodoPrefs tp ( t->summary(), this );
1363 if (QApplication::desktop()->width() <= 800 ){ 1363 if (QApplication::desktop()->width() <= 800 ){
1364 int wid = tp.width(); 1364 int wid = tp.width();
1365 int hei = tp.height(); 1365 int hei = tp.height();
1366 int xx = (QApplication::desktop()->width()-wid)/2; 1366 int xx = (QApplication::desktop()->width()-wid)/2;
1367 int yy = (QApplication::desktop()->height()-hei)/2; 1367 int yy = (QApplication::desktop()->height()-hei)/2;
1368 tp.setGeometry( xx,yy,wid,hei ); 1368 tp.setGeometry( xx,yy,wid,hei );
1369 } 1369 }
1370 if ( !tp.exec() ) return; 1370 if ( !tp.exec() ) return;
1371 if ( tp.stopAll() ) { 1371 if ( tp.stopAll() ) {
1372 mCalendar->stopAllTodos(); 1372 mCalendar->stopAllTodos();
1373 t->setRunning( true ); 1373 t->setRunning( true );
1374 updateView(); 1374 updateView();
1375 } else { 1375 } else {
1376 t->setRunning( true ); 1376 t->setRunning( true );
1377 mActiveItem->construct(); 1377 updateTodo ( t, 0 );
1378 } 1378 }
1379 } 1379 }
1380} 1380}
1381 1381
1382void KOTodoView::itemClicked(QListViewItem *item) 1382void KOTodoView::itemClicked(QListViewItem *item)
1383{ 1383{
1384 //qDebug("KOTodoView::itemClicked %d", item); 1384 //qDebug("KOTodoView::itemClicked %d", item);
1385 if (!item) { 1385 if (!item) {
1386 if ( pendingSubtodo != 0 ) { 1386 if ( pendingSubtodo != 0 ) {
1387 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1387 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1388 } 1388 }
1389 pendingSubtodo = 0; 1389 pendingSubtodo = 0;
1390 return; 1390 return;
1391 } 1391 }
1392 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1392 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1393 if ( pendingSubtodo != 0 ) { 1393 if ( pendingSubtodo != 0 ) {
1394 bool allowReparent = true; 1394 bool allowReparent = true;
1395 QListViewItem *par = item; 1395 QListViewItem *par = item;
1396 while ( par ) { 1396 while ( par ) {
1397 if ( par == pendingSubtodo ) { 1397 if ( par == pendingSubtodo ) {
1398 allowReparent = false; 1398 allowReparent = false;
1399 break; 1399 break;
1400 } 1400 }
1401 par = par->parent(); 1401 par = par->parent();