author | zautrix <zautrix> | 2005-10-22 15:51:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-22 15:51:43 (UTC) |
commit | c643664ae97e757afda1012dc998b49e6cc2d575 (patch) (side-by-side diff) | |
tree | 4af2b52729153d5d194ab46364e38dde85a0efeb /korganizer | |
parent | a29a801e5500a8e5994afc317229698aeebe22e9 (diff) | |
download | kdepimpi-c643664ae97e757afda1012dc998b49e6cc2d575.zip kdepimpi-c643664ae97e757afda1012dc998b49e6cc2d575.tar.gz kdepimpi-c643664ae97e757afda1012dc998b49e6cc2d575.tar.bz2 |
second fix
-rw-r--r-- | korganizer/kotodoview.cpp | 13 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 07bfdbf..a12c43e 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -29,221 +29,230 @@ #include <qlabel.h> #include <qpushbutton.h> #include <qinputdialog.h> #include <qvbox.h> #include <kdebug.h> #include "koprefs.h" #include <klocale.h> #include <kglobal.h> #include <kdateedit.h> #include "ktimeedit.h" #include <kiconloader.h> #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 ) ) ); ede = new KDateEdit( end ); ete = new KOTimeEdit(end ); connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); sde->setDate( mTodo->runStart().date() ); ste->setTime( mTodo->runStart().time() ); - ede->setDate( QDate::currentDate()); - ete->setTime( QTime::currentTime() ); + mStop = QDateTime::currentDateTime(); + ede->setDate( mStop.date()); + ete->setTime( mStop.time() ); QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); lay->addWidget( ok ); ok->setDefault( true ); QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); ok = new QPushButton( i18n("Stop - do not save"), this ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); lay->addWidget( ok ); if (QApplication::desktop()->width() < 320 ) resize( 240, sizeHint().height() ); else resize( 320, sizeHint().height() ); } void KOStopTodoPrefs::accept() { QDateTime start = QDateTime( sde->date(), ste->getTime() ); QDateTime stop = QDateTime( ede->date(), ete->getTime() ); if ( start > stop ) { KMessageBox::sorry(this, i18n("The start time is\nafter the end time!"), i18n("Time mismatch!")); return; } + // restoring the seconds + if ( start == QDateTime( mTodo->runStart().date(), + QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) ) + start = mTodo->runStart(); + if ( stop == QDateTime( mStop.date(), + QTime( mStop.time().hour() , mStop.time().minute() ) ) ) + stop = mStop; + mTodo->saveRunningInfo( mComment->text(), start, stop ); QDialog::accept(); } void KOStopTodoPrefs::doNotSave() { int result = KMessageBox::warningContinueCancel(this, i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); if (result != KMessageBox::Continue) return; mTodo->stopRunning(); QDialog::accept(); } class KOTodoViewWhatsThis :public QWhatsThis { public: KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; protected: virtual QString text( const QPoint& p) { return _view->getWhatsThisText(p) ; } private: QWidget* _wid; KOTodoView * _view; }; KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, const char *name) : KListView(parent,name) { mName = QString ( name ); mCalendar = calendar; #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif mOldCurrent = 0; mMousePressed = false; setAcceptDrops(true); viewport()->setAcceptDrops(true); int size = 16; if (qApp->desktop()->width() < 300 ) size = 12; setTreeStepSize( size + 6 ); } void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } mOldCurrent = currentItem(); #endif } void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } e->accept(); #endif } void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; setCurrentItem(mOldCurrent); setSelected(mOldCurrent,true); #endif } void KOTodoListView::contentsDropEvent(QDropEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 9180015..ecd0ad9 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -1,169 +1,170 @@ /* This file is part of KOrganizer. Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef KOTODOVIEW_H #define KOTODOVIEW_H #include <qfont.h> #include <qfontmetrics.h> #include <qlineedit.h> #include <qptrlist.h> #include <qstrlist.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qlabel.h> #include <qmap.h> #include <qdialog.h> #include <qlabel.h> #include <qlistview.h> #include <klistview.h> #include <libkcal/calendar.h> #include <libkcal/todo.h> #include <korganizer/baseview.h> #include "kotodoviewitem.h" #include "koprefs.h" #include "koglobals.h" #include "datenavigator.h" class QDragEnterEvent; class QDragMoveEvent; class QDragLeaveEvent; class QDropEvent; class KOTodoViewWhatsThis; class KDateEdit; class KOTimeEdit; class DocPrefs; class KOStopTodoPrefs : public QDialog { Q_OBJECT public: KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; private slots: void doNotSave(); void accept(); private: Todo* mTodo; QLineEdit* mComment; + QDateTime mStop; KDateEdit *sde, *ede; KOTimeEdit *ste, *ete; }; class KOStartTodoPrefs : public QDialog { Q_OBJECT public: KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ; bool stopAll() { return mStopAll; } private slots: void doStop(); private: bool mStopAll; }; class KOTodoListView : public KListView { Q_OBJECT public: KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); virtual ~KOTodoListView() {} signals: void paintNeeded(); void todoDropped(Todo *, int); void double_Clicked(QListViewItem *item); void reparentTodoSignal( Todo *,Todo * ); void unparentTodoSignal(Todo *); void deleteTodo( Todo * ); protected: void wheelEvent (QWheelEvent *e); void contentsDragEnterEvent(QDragEnterEvent *); void contentsDragMoveEvent(QDragMoveEvent *); void contentsDragLeaveEvent(QDragLeaveEvent *); void contentsDropEvent(QDropEvent *); void contentsMousePressEvent(QMouseEvent *); void contentsMouseMoveEvent(QMouseEvent *); void contentsMouseReleaseEvent(QMouseEvent *); void contentsMouseDoubleClickEvent(QMouseEvent *); private: void paintEvent(QPaintEvent * pevent); bool internalDrop; QString mName; Calendar *mCalendar; QPoint mPressPos; bool mMousePressed; QListViewItem *mOldCurrent; bool mFlagKeyPressed; void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; }; /** This is the line-edit on top of the todoview for fast addition of new todos */ class KOQuickTodo : public QLineEdit { public: KOQuickTodo(QWidget *parent=0); protected: void focusInEvent(QFocusEvent *ev); void focusOutEvent(QFocusEvent *ev); }; /** This class provides a multi-column list view of todo events. @short multi-column list view of todo events. @author Cornelius Schumacher <schumacher@kde.org> */ class KOTodoView : public KOrg::BaseView { Q_OBJECT public: KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); ~KOTodoView(); QPtrList<Incidence> selectedIncidences(); QPtrList<Todo> selectedTodos(); DateList selectedDates() {DateList q; return q;} /** Return number of shown dates. TodoView does not show dates, */ int currentDateCount() { return 0; } void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |