summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp50
1 files changed, 46 insertions, 4 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 7349d20..1bfdef9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -42,48 +42,78 @@
#include <kmessagebox.h>
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/calfilter.h>
#include <libkcal/dndfactory.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include <libkcal/kincidenceformatter.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "docprefs.h"
#include "kotodoview.h"
using namespace KOrg;
+KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
+ QDialog( parent, name, true )
+{
+ mStopAll = true;
+ setCaption( i18n("Start todo") );
+ QVBoxLayout* lay = new QVBoxLayout( this );
+ lay->setSpacing( 3 );
+ lay->setMargin( 3 );
+ QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
+ lay->addWidget( lab );
+ lab->setAlignment( AlignCenter );
+
+ QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
+ lay->addWidget( ok );
+ ok->setDefault( true );
+ QPushButton * start = new QPushButton( i18n("Start todo"), this );
+ lay->addWidget( start );
+ QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
+ lay->addWidget( cancel );
+ connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
+ connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
+ connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
+ resize( sizeHint() );
+
+}
+void KOStartTodoPrefs::doStop()
+{
+ mStopAll = false;
+ accept();
+}
KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
QDialog( parent, name, true )
{
mTodo = todo;
setCaption( i18n("Stop todo") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
lay->addWidget( lab );
lab->setAlignment( AlignHCenter );
lab = new QLabel( i18n("Additional Comment:"), this );
lay->addWidget( lab );
mComment = new QLineEdit( this );
lay->addWidget( mComment );
QHBox * start = new QHBox ( this );
lay->addWidget( start );
lab = new QLabel( i18n("Start:"), start );
QHBox * end = new QHBox ( this );
lay->addWidget( end );
lab = new QLabel( i18n("End:"), end );
sde = new KDateEdit( start );
ste = new KOTimeEdit( start );
connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
@@ -1198,65 +1228,77 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
else
toggleRunningItem();
return;
} else {
t->setRunning( true );
mActiveItem->construct();
topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
return;
}
}
}
if ( KOPrefs::instance()->mEditOnDoubleClick )
editItem( item );
else
showItem( item , QPoint(), 0 );
}
void KOTodoView::toggleRunningItem()
{
// qDebug("KOTodoView::toggleRunning() ");
if ( ! mActiveItem )
return;
Todo * t = mActiveItem->todo();
if ( t->isRunning() ) {
KOStopTodoPrefs tp ( t, this );
- if (QApplication::desktop()->width() < 800 ){
+ if (QApplication::desktop()->width() <= 800 ){
int wid = tp.width();
int hei = tp.height();
int xx = (QApplication::desktop()->width()-wid)/2;
int yy = (QApplication::desktop()->height()-hei)/2;
tp.setGeometry( xx,yy,wid,hei );
}
tp.exec();
mActiveItem->construct();
} else {
- int result = KMessageBox::warningContinueCancel(this,
- 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);
- if (result != KMessageBox::Continue) return;
+ KOStartTodoPrefs tp ( t->summary(), this );
+ if (QApplication::desktop()->width() <= 800 ){
+ int wid = tp.width();
+ int hei = tp.height();
+ int xx = (QApplication::desktop()->width()-wid)/2;
+ int yy = (QApplication::desktop()->height()-hei)/2;
+ tp.setGeometry( xx,yy,wid,hei );
+ }
+ if ( !tp.exec() ) return;
+ if ( tp.stopAll() ) {
+ mCalendar->stopAllTodos();
+ t->setRunning( true );
+ updateView();
+ } else {
t->setRunning( true );
mActiveItem->construct();
}
}
+}
void KOTodoView::itemClicked(QListViewItem *item)
{
//qDebug("KOTodoView::itemClicked %d", item);
if (!item) {
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
return;
}
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
if ( pendingSubtodo != 0 ) {
bool allowReparent = true;
QListViewItem *par = item;
while ( par ) {
if ( par == pendingSubtodo ) {
allowReparent = false;
break;
}
par = par->parent();
}
if ( !allowReparent ) {
topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));