summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
authorzautrix <zautrix>2005-06-17 10:27:21 (UTC)
committer zautrix <zautrix>2005-06-17 10:27:21 (UTC)
commitec691904e9c129fda7514179910c5be9bf0d908b (patch) (unidiff)
tree75984d135b97049af03ba22eab7f7db53a8a7922 /korganizer/kotodoview.cpp
parent56f20e7a0a6b8ecf84d11ced19f870241a13c17d (diff)
downloadkdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.zip
kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.gz
kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.bz2
fixxx
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 13e88ef..926a136 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -75,48 +75,49 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name
75 lay->addWidget( lab ); 75 lay->addWidget( lab );
76 lab->setAlignment( AlignHCenter ); 76 lab->setAlignment( AlignHCenter );
77 lab = new QLabel( i18n("Additional Comment:"), this ); 77 lab = new QLabel( i18n("Additional Comment:"), this );
78 lay->addWidget( lab ); 78 lay->addWidget( lab );
79 mComment = new QLineEdit( this ); 79 mComment = new QLineEdit( this );
80 lay->addWidget( mComment ); 80 lay->addWidget( mComment );
81 QHBox * start = new QHBox ( this ); 81 QHBox * start = new QHBox ( this );
82 lay->addWidget( start ); 82 lay->addWidget( start );
83 lab = new QLabel( i18n("Start:"), start ); 83 lab = new QLabel( i18n("Start:"), start );
84 QHBox * end = new QHBox ( this ); 84 QHBox * end = new QHBox ( this );
85 lay->addWidget( end ); 85 lay->addWidget( end );
86 lab = new QLabel( i18n("End:"), end ); 86 lab = new QLabel( i18n("End:"), end );
87 sde = new KDateEdit( start ); 87 sde = new KDateEdit( start );
88 ste = new KOTimeEdit( start ); 88 ste = new KOTimeEdit( start );
89 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 89 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
90 ede = new KDateEdit( end ); 90 ede = new KDateEdit( end );
91 ete = new KOTimeEdit(end ); 91 ete = new KOTimeEdit(end );
92 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 92 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
93 sde->setDate( mTodo->runStart().date() ); 93 sde->setDate( mTodo->runStart().date() );
94 ste->setTime( mTodo->runStart().time() ); 94 ste->setTime( mTodo->runStart().time() );
95 ede->setDate( QDate::currentDate()); 95 ede->setDate( QDate::currentDate());
96 ete->setTime( QTime::currentTime() ); 96 ete->setTime( QTime::currentTime() );
97 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 97 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
98 lay->addWidget( ok ); 98 lay->addWidget( ok );
99 ok->setDefault( true );
99 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 100 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
100 lay->addWidget( cancel ); 101 lay->addWidget( cancel );
101 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 102 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
102 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 103 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
103 ok = new QPushButton( i18n("Stop - do not save"), this ); 104 ok = new QPushButton( i18n("Stop - do not save"), this );
104 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 105 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
105 lay->addWidget( ok ); 106 lay->addWidget( ok );
106 if (QApplication::desktop()->width() < 320 ) 107 if (QApplication::desktop()->width() < 320 )
107 resize( 240, 200 ); 108 resize( 240, 200 );
108 else 109 else
109 resize( 320, 200 ); 110 resize( 320, 200 );
110 111
111} 112}
112 113
113void KOStopTodoPrefs::accept() 114void KOStopTodoPrefs::accept()
114{ 115{
115 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 116 QDateTime start = QDateTime( sde->date(), ste->getTime() );
116 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 117 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
117 if ( start > stop ) { 118 if ( start > stop ) {
118 KMessageBox::sorry(this, 119 KMessageBox::sorry(this,
119 i18n("The start time is\nafter the end time!"), 120 i18n("The start time is\nafter the end time!"),
120 i18n("Time mismatch!")); 121 i18n("Time mismatch!"));
121 return; 122 return;
122 } 123 }
@@ -1181,68 +1182,51 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1181 } else { 1182 } else {
1182 if ( row == 2 || row == 1 ) { 1183 if ( row == 2 || row == 1 ) {
1183 mActiveItem = (KOTodoViewItem *) item; 1184 mActiveItem = (KOTodoViewItem *) item;
1184 newSubTodo(); 1185 newSubTodo();
1185 return; 1186 return;
1186 } 1187 }
1187 if ( row == 5 || row == 6 ) { 1188 if ( row == 5 || row == 6 ) {
1188 mActiveItem = (KOTodoViewItem *) item; 1189 mActiveItem = (KOTodoViewItem *) item;
1189 toggleRunningItem(); 1190 toggleRunningItem();
1190 return; 1191 return;
1191 } 1192 }
1192 } 1193 }
1193 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1194 if ( KOPrefs::instance()->mEditOnDoubleClick )
1194 editItem( item ); 1195 editItem( item );
1195 else 1196 else
1196 showItem( item , QPoint(), 0 ); 1197 showItem( item , QPoint(), 0 );
1197} 1198}
1198void KOTodoView::toggleRunningItem() 1199void KOTodoView::toggleRunningItem()
1199{ 1200{
1200 // qDebug("KOTodoView::toggleRunning() "); 1201 // qDebug("KOTodoView::toggleRunning() ");
1201 if ( ! mActiveItem ) 1202 if ( ! mActiveItem )
1202 return; 1203 return;
1203 Todo * t = mActiveItem->todo(); 1204 Todo * t = mActiveItem->todo();
1204 if ( t->isRunning() ) { 1205 if ( t->isRunning() ) {
1205
1206
1207 KOStopTodoPrefs tp ( t, this ); 1206 KOStopTodoPrefs tp ( t, this );
1208 tp.exec(); 1207 tp.exec();
1209
1210
1211#if 0
1212 int result = KMessageBox::warningYesNoCancel(this,
1213 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note"));
1214 if (result == KMessageBox::Cancel) return;
1215 if ( result == KMessageBox::No ) {
1216 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") );
1217 t->setRunningFalse( comment );
1218 } else {
1219 t->setRunning( false );
1220 }
1221 mActiveItem->construct(); 1208 mActiveItem->construct();
1222
1223
1224#endif
1225 } else { 1209 } else {
1226 int result = KMessageBox::warningContinueCancel(this, 1210 int result = KMessageBox::warningContinueCancel(this,
1227 i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); 1211 i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true);
1228 if (result != KMessageBox::Continue) return; 1212 if (result != KMessageBox::Continue) return;
1229 t->setRunning( true ); 1213 t->setRunning( true );
1230 mActiveItem->construct(); 1214 mActiveItem->construct();
1231 } 1215 }
1232} 1216}
1233 1217
1234void KOTodoView::itemClicked(QListViewItem *item) 1218void KOTodoView::itemClicked(QListViewItem *item)
1235{ 1219{
1236 //qDebug("KOTodoView::itemClicked %d", item); 1220 //qDebug("KOTodoView::itemClicked %d", item);
1237 if (!item) { 1221 if (!item) {
1238 if ( pendingSubtodo != 0 ) { 1222 if ( pendingSubtodo != 0 ) {
1239 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1223 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1240 } 1224 }
1241 pendingSubtodo = 0; 1225 pendingSubtodo = 0;
1242 return; 1226 return;
1243 } 1227 }
1244 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1228 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1245 if ( pendingSubtodo != 0 ) { 1229 if ( pendingSubtodo != 0 ) {
1246 bool allowReparent = true; 1230 bool allowReparent = true;
1247 QListViewItem *par = item; 1231 QListViewItem *par = item;
1248 while ( par ) { 1232 while ( par ) {