summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp56
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
@@ -12,32 +12,35 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qdialog.h>
29#include <qlabel.h>
30#include <qpushbutton.h>
28 31
29#include <qinputdialog.h> 32#include <qinputdialog.h>
30 33
31#include <qvbox.h> 34#include <qvbox.h>
32#include <kdebug.h> 35#include <kdebug.h>
33#include "koprefs.h" 36#include "koprefs.h"
34#include <klocale.h> 37#include <klocale.h>
35#include <kglobal.h> 38#include <kglobal.h>
36#include <kiconloader.h> 39#include <kiconloader.h>
37#include <kmessagebox.h> 40#include <kmessagebox.h>
38 41
39#include <libkcal/icaldrag.h> 42#include <libkcal/icaldrag.h>
40#include <libkcal/vcaldrag.h> 43#include <libkcal/vcaldrag.h>
41#include <libkcal/calfilter.h> 44#include <libkcal/calfilter.h>
42#include <libkcal/dndfactory.h> 45#include <libkcal/dndfactory.h>
43#include <libkcal/calendarresources.h> 46#include <libkcal/calendarresources.h>
@@ -45,32 +48,72 @@
45#include <kresources/resourceselectdialog.h> 48#include <kresources/resourceselectdialog.h>
46#include <libkcal/kincidenceformatter.h> 49#include <libkcal/kincidenceformatter.h>
47#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
48#include <qpe/qpeapplication.h> 51#include <qpe/qpeapplication.h>
49#else 52#else
50#include <qapplication.h> 53#include <qapplication.h>
51#endif 54#endif
52#ifndef KORG_NOPRINTER 55#ifndef KORG_NOPRINTER
53#include "calprinter.h" 56#include "calprinter.h"
54#endif 57#endif
55#include "docprefs.h" 58#include "docprefs.h"
56 59
57#include "kotodoview.h" 60#include "kotodoview.h"
58using namespace KOrg; 61using namespace KOrg;
59 62
60 63
64KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
65 QDialog( parent, name, true )
66{
67 mTodo = todo;
68 setCaption( i18n("Stop todo") );
69 QVBoxLayout* lay = new QVBoxLayout( this );
70 lay->setSpacing( 3 );
71 lay->setMargin( 3 );
72 QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this );
73 lay->addWidget( lab );
74 lab->setAlignment( AlignHCenter );
75
76 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
77 lay->addWidget( ok );
78 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
79 lay->addWidget( cancel );
80 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
81 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
82 ok = new QPushButton( i18n("Stop - do not save"), this );
83 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
84 lay->addWidget( ok );
85 resize( 200, 200 );
86}
87
88void KOStopTodoPrefs::accept()
89{
90 qDebug("KOStopTodoPrefs::accept() ");
91 QDialog::accept();
92}
93void KOStopTodoPrefs::doNotSave()
94{
95
96 int result = KMessageBox::warningContinueCancel(this,
97 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() );
98 if (result != KMessageBox::Continue) return;
99 mTodo->stopRunning();
100 QDialog::accept();
101}
102
103
61class KOTodoViewWhatsThis :public QWhatsThis 104class KOTodoViewWhatsThis :public QWhatsThis
62{ 105{
63public: 106public:
64 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 107 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
65 108
66protected: 109protected:
67 virtual QString text( const QPoint& p) 110 virtual QString text( const QPoint& p)
68 { 111 {
69 return _view->getWhatsThisText(p) ; 112 return _view->getWhatsThisText(p) ;
70 } 113 }
71private: 114private:
72 QWidget* _wid; 115 QWidget* _wid;
73 KOTodoView * _view; 116 KOTodoView * _view;
74}; 117};
75 118
76KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 119KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
@@ -1114,47 +1157,52 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1114 toggleRunningItem(); 1157 toggleRunningItem();
1115 return; 1158 return;
1116 } 1159 }
1117 } 1160 }
1118 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1161 if ( KOPrefs::instance()->mEditOnDoubleClick )
1119 editItem( item ); 1162 editItem( item );
1120 else 1163 else
1121 showItem( item , QPoint(), 0 ); 1164 showItem( item , QPoint(), 0 );
1122} 1165}
1123void KOTodoView::toggleRunningItem() 1166void KOTodoView::toggleRunningItem()
1124{ 1167{
1125 // qDebug("KOTodoView::toggleRunning() "); 1168 // qDebug("KOTodoView::toggleRunning() ");
1126 if ( ! mActiveItem ) 1169 if ( ! mActiveItem )
1127 return; 1170 return;
1128 Todo * t = mActiveItem->todo(); 1171 Todo * t = mActiveItem->todo();
1129 if ( t->isRunning() ) { 1172 if ( t->isRunning() ) {
1130#if 0
1131 int result = KMessageBox::warningContinueCancel(this,
1132 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);
1133#endif
1134 1173
1174
1175 KOStopTodoPrefs tp ( t, this );
1176 tp.exec();
1177
1178
1179#if 0
1135 int result = KMessageBox::warningYesNoCancel(this, 1180 int result = KMessageBox::warningYesNoCancel(this,
1136 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")); 1181 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"));
1137 if (result == KMessageBox::Cancel) return; 1182 if (result == KMessageBox::Cancel) return;
1138 if ( result == KMessageBox::No ) { 1183 if ( result == KMessageBox::No ) {
1139 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") ); 1184 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") );
1140 t->setRunningFalse( comment ); 1185 t->setRunningFalse( comment );
1141 } else { 1186 } else {
1142 t->setRunning( false ); 1187 t->setRunning( false );
1143 } 1188 }
1144 mActiveItem->construct(); 1189 mActiveItem->construct();
1190
1191
1192#endif
1145 } else { 1193 } else {
1146 int result = KMessageBox::warningContinueCancel(this, 1194 int result = KMessageBox::warningContinueCancel(this,
1147 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); 1195 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);
1148 if (result != KMessageBox::Continue) return; 1196 if (result != KMessageBox::Continue) return;
1149 t->setRunning( true ); 1197 t->setRunning( true );
1150 mActiveItem->construct(); 1198 mActiveItem->construct();
1151 } 1199 }
1152} 1200}
1153 1201
1154void KOTodoView::itemClicked(QListViewItem *item) 1202void KOTodoView::itemClicked(QListViewItem *item)
1155{ 1203{
1156 //qDebug("KOTodoView::itemClicked %d", item); 1204 //qDebug("KOTodoView::itemClicked %d", item);
1157 if (!item) { 1205 if (!item) {
1158 if ( pendingSubtodo != 0 ) { 1206 if ( pendingSubtodo != 0 ) {
1159 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1207 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1160 } 1208 }