author | zautrix <zautrix> | 2005-06-17 07:51:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-17 07:51:48 (UTC) |
commit | 825c34c11200f8ff0229cfb00b82b1880ef55b94 (patch) (side-by-side diff) | |
tree | 243df776d77afe55ca36ca8a78586a9e2fca1888 /korganizer/kotodoview.cpp | |
parent | a04fff3ce192e0bebf9243a1fbedb97cf7108d2b (diff) | |
download | kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.zip kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.tar.gz kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kotodoview.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index b2ff33b..99e6a3a 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -4,81 +4,124 @@ 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. */ #include <qlayout.h> #include <qheader.h> #include <qcursor.h> #include <qwhatsthis.h> +#include <qdialog.h> +#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 <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; +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("%1\nis running!").arg( todo->summary() ), this ); + lay->addWidget( lab ); + lab->setAlignment( AlignHCenter ); + + QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); + lay->addWidget( ok ); + 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 ); + resize( 200, 200 ); +} + +void KOStopTodoPrefs::accept() +{ + qDebug("KOStopTodoPrefs::accept() "); + 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() ); + 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 @@ -1106,63 +1149,68 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } else { if ( row == 2 || row == 1 ) { mActiveItem = (KOTodoViewItem *) item; newSubTodo(); return; } if ( row == 5 || row == 6 ) { mActiveItem = (KOTodoViewItem *) item; toggleRunningItem(); 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() ) { -#if 0 - int result = KMessageBox::warningContinueCancel(this, - 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 todo"),i18n("Cancel"), true); -#endif + + KOStopTodoPrefs tp ( t, this ); + tp.exec(); + + +#if 0 int result = KMessageBox::warningYesNoCancel(this, 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")); if (result == KMessageBox::Cancel) return; if ( result == KMessageBox::No ) { QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); t->setRunningFalse( comment ); } else { t->setRunning( false ); } mActiveItem->construct(); + + +#endif } else { int result = KMessageBox::warningContinueCancel(this, i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); if (result != KMessageBox::Continue) return; 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 ) { |