summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/kotodoview.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f5eb52e..496f125 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,251 +1,252 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
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 <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qfile.h> 32#include <qfile.h>
33 33
34 34
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42 42
43#include <libkcal/todo.h> 43#include <libkcal/todo.h>
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "koglobals.h" 49#include "koglobals.h"
50 50
51#include "koeditorgeneral.h" 51#include "koeditorgeneral.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#else 55#else
56#include <qapplication.h> 56#include <qapplication.h>
57#endif 57#endif
58 58
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 60 QObject( parent, name)
61{ 61{
62} 62}
63 63
64KOEditorGeneral::~KOEditorGeneral() 64KOEditorGeneral::~KOEditorGeneral()
65{ 65{
66} 66}
67 67
68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
69{ 69{
70 QGridLayout *headerLayout = new QGridLayout(topLayout); 70 QGridLayout *headerLayout = new QGridLayout(topLayout);
71 71
72#if 0 72#if 0
73 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 73 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
75#endif 75#endif
76 76
77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
78 headerLayout->addWidget(summaryLabel,1,0); 78 headerLayout->addWidget(summaryLabel,1,0);
79 79
80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
85 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
86 mSummaryEdit->setMaximumHeight( hei +6 ); 86 mSummaryEdit->setMaximumHeight( hei +6 );
87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
89 // mSummaryEdit = new QLineEdit(parent); 89 // mSummaryEdit = new QLineEdit(parent);
90 headerLayout->addWidget(mSummaryEdit,1,1); 90 headerLayout->addWidget(mSummaryEdit,1,1);
91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
92 92
93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
94 headerLayout->addWidget(locationLabel,2,0); 94 headerLayout->addWidget(locationLabel,2,0);
95 95
96 mLocationEdit = new KOLocationBox(TRUE,parent,10); 96 mLocationEdit = new KOLocationBox(TRUE,parent,10);
97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
98 if ( QApplication::desktop()->width() > 320 ) 98 if ( QApplication::desktop()->width() > 320 )
99 mLocationEdit->setMaximumHeight( hei + 6); 99 mLocationEdit->setMaximumHeight( hei + 6);
100 100
101 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
105} 105}
106void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
107{ 107{
108 qApp->processEvents(); 108 qApp->processEvents();
109 if ( i == 1 ) { 109 if ( i == 1 ) {
110 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 112 }
113 if ( i == 2 ) { 113 if ( i == 2 ) {
114 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
115 } 115 }
116 116
117} 117}
118void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
119{ 119{
120 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled();
124 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
125 csd->exec(); 126 csd->exec();
126 delete csd; 127 delete csd;
127} 128}
128void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
129{ 130{
130 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
131 132
132 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
133 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
134 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
135 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
136 137
137 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
138 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
139 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
140} 141}
141 142
142void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
143{ 144{
144 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
145 146
146 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
147 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
148 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
149 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
150 151
151 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
152 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
153 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
154} 155}
155 156
156void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
157{ 158{
158 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
159 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
160 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
161 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
162 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
163 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
164 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
165#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
166 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
167#endif 168#endif
168 169
169} 170}
170 171
171void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
172{ 173{
173 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
174 175
175 //mAlarmBell = new QLabel(parent); 176 //mAlarmBell = new QLabel(parent);
176 //mAlarmBell->setPixmap(SmallIcon("bell")); 177 //mAlarmBell->setPixmap(SmallIcon("bell"));
177 //alarmLayout->addWidget(mAlarmBell); 178 //alarmLayout->addWidget(mAlarmBell);
178 if ( QApplication::desktop()->width() < 320 ) 179 if ( QApplication::desktop()->width() < 320 )
179 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 180 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
180 else 181 else
181 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
182 183
183 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
184 alarmLayout->addWidget(mAlarmButton); 185 alarmLayout->addWidget(mAlarmButton);
185 186
186 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
187 alarmLayout->addWidget(mAlarmTimeEdit); 188 alarmLayout->addWidget(mAlarmTimeEdit);
188 mAlarmIncrCombo = new QComboBox(false, parent); 189 mAlarmIncrCombo = new QComboBox(false, parent);
189 if ( QApplication::desktop()->width() < 320 ) { 190 if ( QApplication::desktop()->width() < 320 ) {
190 mAlarmIncrCombo->insertItem(i18n("min")); 191 mAlarmIncrCombo->insertItem(i18n("min"));
191 mAlarmIncrCombo->insertItem(i18n("hou")); 192 mAlarmIncrCombo->insertItem(i18n("hou"));
192 mAlarmIncrCombo->insertItem(i18n("day")); 193 mAlarmIncrCombo->insertItem(i18n("day"));
193 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
194 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
195 } else { 196 } else {
196 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 197 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
197 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 198 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
198 mAlarmIncrCombo->insertItem(i18n("day(s)")); 199 mAlarmIncrCombo->insertItem(i18n("day(s)"));
199 } 200 }
200 201
201 // mAlarmIncrCombo->setMinimumHeight(20); 202 // mAlarmIncrCombo->setMinimumHeight(20);
202 alarmLayout->addWidget(mAlarmIncrCombo); 203 alarmLayout->addWidget(mAlarmIncrCombo);
203 mAlarmSoundButton = new QPushButton(parent); 204 mAlarmSoundButton = new QPushButton(parent);
204 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 205 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
205 mAlarmSoundButton->setToggleButton(true); 206 mAlarmSoundButton->setToggleButton(true);
206 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 207 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
207 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
208 alarmLayout->addWidget(mAlarmSoundButton); 209 alarmLayout->addWidget(mAlarmSoundButton);
209 210
210 mAlarmProgramButton = new QPushButton(parent); 211 mAlarmProgramButton = new QPushButton(parent);
211 mAlarmProgramButton->setPixmap(SmallIcon("run")); 212 mAlarmProgramButton->setPixmap(SmallIcon("run"));
212 mAlarmProgramButton->setToggleButton(true); 213 mAlarmProgramButton->setToggleButton(true);
213 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 214 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
214 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
215 alarmLayout->addWidget(mAlarmProgramButton); 216 alarmLayout->addWidget(mAlarmProgramButton);
216 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
217 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
218 // if ( KOPrefs::instance()->mCompactDialogs ) { 219 // if ( KOPrefs::instance()->mCompactDialogs ) {
219 // mAlarmSoundButton->hide(); 220 // mAlarmSoundButton->hide();
220 // mAlarmProgramButton->hide(); 221 // mAlarmProgramButton->hide();
221 // } 222 // }
222} 223}
223 224
224void KOEditorGeneral::pickAlarmSound() 225void KOEditorGeneral::pickAlarmSound()
225{ 226{
226 227
227 //QString prefix = mAlarmSound; 228 //QString prefix = mAlarmSound;
228 if (!mAlarmSoundButton->isOn()) { 229 if (!mAlarmSoundButton->isOn()) {
229 //mAlarmSound = ""; 230 //mAlarmSound = "";
230 QToolTip::remove(mAlarmSoundButton); 231 QToolTip::remove(mAlarmSoundButton);
231 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 232 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
232 mAlarmProgramButton->setOn(true); 233 mAlarmProgramButton->setOn(true);
233 mAlarmSoundButton->setOn(false); 234 mAlarmSoundButton->setOn(false);
234 } else { 235 } else {
235 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 236 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
236 i18n("*.wav|Wav Files"), 0)); 237 i18n("*.wav|Wav Files"), 0));
237 if (!fileName.isEmpty()) { 238 if (!fileName.isEmpty()) {
238 mAlarmSound = fileName; 239 mAlarmSound = fileName;
239 QToolTip::remove(mAlarmSoundButton); 240 QToolTip::remove(mAlarmSoundButton);
240 QString dispStr = i18n("Playing '%1'").arg(fileName); 241 QString dispStr = i18n("Playing '%1'").arg(fileName);
241 QToolTip::add(mAlarmSoundButton, dispStr); 242 QToolTip::add(mAlarmSoundButton, dispStr);
242 mAlarmProgramButton->setOn(false); 243 mAlarmProgramButton->setOn(false);
243 mAlarmSoundButton->setOn(true); 244 mAlarmSoundButton->setOn(true);
244 } else { 245 } else {
245 mAlarmProgramButton->setOn(true); 246 mAlarmProgramButton->setOn(true);
246 mAlarmSoundButton->setOn(false); 247 mAlarmSoundButton->setOn(false);
247 248
248 } 249 }
249 } 250 }
250 251
251 if (mAlarmProgramButton->isOn()) 252 if (mAlarmProgramButton->isOn())
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -836,261 +836,268 @@ void KOTodoView::newTodo()
836 emit newTodoSignal(); 836 emit newTodoSignal();
837} 837}
838 838
839void KOTodoView::newSubTodo() 839void KOTodoView::newSubTodo()
840{ 840{
841 if (mActiveItem) { 841 if (mActiveItem) {
842 emit newSubTodoSignal(mActiveItem->todo()); 842 emit newSubTodoSignal(mActiveItem->todo());
843 } 843 }
844} 844}
845void KOTodoView::unparentTodo() 845void KOTodoView::unparentTodo()
846{ 846{
847 if (mActiveItem) { 847 if (mActiveItem) {
848 emit unparentTodoSignal(mActiveItem->todo()); 848 emit unparentTodoSignal(mActiveItem->todo());
849 } 849 }
850} 850}
851 851
852void KOTodoView::reparentTodo() 852void KOTodoView::reparentTodo()
853{ 853{
854 if (mActiveItem) { 854 if (mActiveItem) {
855 qDebug("KOTodoView::reparentTodo() "); 855 qDebug("KOTodoView::reparentTodo() ");
856 topLevelWidget()->setCaption(i18n("Click on new parent item")); 856 topLevelWidget()->setCaption(i18n("Click on new parent item"));
857 pendingSubtodo = mActiveItem; 857 pendingSubtodo = mActiveItem;
858 } 858 }
859} 859}
860void KOTodoView::editTodo() 860void KOTodoView::editTodo()
861{ 861{
862 if (mActiveItem) { 862 if (mActiveItem) {
863 emit editTodoSignal(mActiveItem->todo()); 863 emit editTodoSignal(mActiveItem->todo());
864 } 864 }
865} 865}
866void KOTodoView::cloneTodo() 866void KOTodoView::cloneTodo()
867{ 867{
868 if (mActiveItem) { 868 if (mActiveItem) {
869 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 869 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
870 } 870 }
871} 871}
872void KOTodoView::cancelTodo() 872void KOTodoView::cancelTodo()
873{ 873{
874 if (mActiveItem) { 874 if (mActiveItem) {
875 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 875 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
876 } 876 }
877} 877}
878void KOTodoView::moveTodo() 878void KOTodoView::moveTodo()
879{ 879{
880 if (mActiveItem) { 880 if (mActiveItem) {
881 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 881 emit moveTodoSignal((Incidence*)mActiveItem->todo());
882 } 882 }
883} 883}
884void KOTodoView::beamTodo() 884void KOTodoView::beamTodo()
885{ 885{
886 if (mActiveItem) { 886 if (mActiveItem) {
887 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 887 emit beamTodoSignal((Incidence*)mActiveItem->todo());
888 } 888 }
889} 889}
890 890
891 891
892void KOTodoView::showTodo() 892void KOTodoView::showTodo()
893{ 893{
894 if (mActiveItem) { 894 if (mActiveItem) {
895 emit showTodoSignal(mActiveItem->todo()); 895 emit showTodoSignal(mActiveItem->todo());
896 } 896 }
897} 897}
898 898
899void KOTodoView::deleteTodo() 899void KOTodoView::deleteTodo()
900{ 900{
901 if (mActiveItem) { 901 if (mActiveItem) {
902 emit deleteTodoSignal(mActiveItem->todo()); 902 emit deleteTodoSignal(mActiveItem->todo());
903 } 903 }
904} 904}
905 905
906void KOTodoView::setNewPriority(int index) 906void KOTodoView::setNewPriority(int index)
907{ 907{
908 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 908 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
909 mActiveItem->todo()->setPriority(mPriority[index]); 909 mActiveItem->todo()->setPriority(mPriority[index]);
910 mActiveItem->construct(); 910 mActiveItem->construct();
911 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 911 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
912 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 912 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
913 } 913 }
914} 914}
915 915
916void KOTodoView::setNewPercentage(int index) 916void KOTodoView::setNewPercentage(int index)
917{ 917{
918 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 918 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
919 919
920 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 920 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
921 mActiveItem->setOn( true ); 921 mActiveItem->setOn( true );
922 return; 922 return;
923 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 923 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
924 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 924 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
925 if ( par && par->isOn() ) 925 if ( par && par->isOn() )
926 par->setOn( false ); 926 par->setOn( false );
927 } 927 }
928 if (mPercentage[index] == 100) { 928 if (mPercentage[index] == 100) {
929 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 929 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
930 } else { 930 } else {
931 mActiveItem->todo()->setCompleted(false); 931 mActiveItem->todo()->setCompleted(false);
932 } 932 }
933 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 933 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
934 mActiveItem->construct(); 934 mActiveItem->construct();
935 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 935 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
936 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 936 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
937 } 937 }
938} 938}
939 939
940 940
941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
942{ 942{
943 QPopupMenu* tempMenu = new QPopupMenu (this); 943 QPopupMenu* tempMenu = new QPopupMenu (this);
944 QStringList checkedCategories = todoItem->todo()->categories (); 944 QStringList checkedCategories = todoItem->todo()->categories ();
945 945
946 tempMenu->setCheckable (true); 946 tempMenu->setCheckable (true);
947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
948 it != KOPrefs::instance()->mCustomCategories.end (); 948 it != KOPrefs::instance()->mCustomCategories.end ();
949 ++it) { 949 ++it) {
950 int index = tempMenu->insertItem (*it); 950 int index = tempMenu->insertItem (*it);
951 mCategory[index] = *it; 951 mCategory[index] = *it;
952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
953 } 953 }
954 954
955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
956 return tempMenu; 956 return tempMenu;
957 957
958 958
959} 959}
960void KOTodoView::changedCategories(int index) 960void KOTodoView::changedCategories(int index)
961{ 961{
962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
963 QStringList categories = mActiveItem->todo()->categories (); 963 QStringList categories = mActiveItem->todo()->categories ();
964 QString colcat = categories.first();
964 if (categories.find (mCategory[index]) != categories.end ()) 965 if (categories.find (mCategory[index]) != categories.end ())
965 categories.remove (mCategory[index]); 966 categories.remove (mCategory[index]);
966 else 967 else
967 categories.insert (categories.end(), mCategory[index]); 968 categories.insert (categories.end(), mCategory[index]);
968 categories.sort (); 969 categories.sort ();
970 if ( !colcat.isEmpty() ) {
971 if ( categories.find ( colcat ) != categories.end () ) {
972 categories.remove( colcat );
973 categories.prepend( colcat );
974 }
975 }
969 mActiveItem->todo()->setCategories (categories); 976 mActiveItem->todo()->setCategories (categories);
970 mActiveItem->construct(); 977 mActiveItem->construct();
971 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 978 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
972 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 979 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
973 } 980 }
974} 981}
975void KOTodoView::itemDoubleClicked(QListViewItem *item) 982void KOTodoView::itemDoubleClicked(QListViewItem *item)
976{ 983{
977 if ( pendingSubtodo != 0 ) { 984 if ( pendingSubtodo != 0 ) {
978 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 985 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
979 } 986 }
980 pendingSubtodo = 0; 987 pendingSubtodo = 0;
981 if (!item) { 988 if (!item) {
982 newTodo(); 989 newTodo();
983 return; 990 return;
984 } 991 }
985 if ( KOPrefs::instance()->mEditOnDoubleClick ) 992 if ( KOPrefs::instance()->mEditOnDoubleClick )
986 editItem( item ); 993 editItem( item );
987 else 994 else
988 showItem( item , QPoint(), 0 ); 995 showItem( item , QPoint(), 0 );
989} 996}
990void KOTodoView::itemClicked(QListViewItem *item) 997void KOTodoView::itemClicked(QListViewItem *item)
991{ 998{
992 999
993 if (!item) { 1000 if (!item) {
994 if ( pendingSubtodo != 0 ) { 1001 if ( pendingSubtodo != 0 ) {
995 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1002 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
996 } 1003 }
997 pendingSubtodo = 0; 1004 pendingSubtodo = 0;
998 return; 1005 return;
999 } 1006 }
1000 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1007 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1001 if ( pendingSubtodo != 0 ) { 1008 if ( pendingSubtodo != 0 ) {
1002 bool allowReparent = true; 1009 bool allowReparent = true;
1003 QListViewItem *par = item; 1010 QListViewItem *par = item;
1004 while ( par ) { 1011 while ( par ) {
1005 if ( par == pendingSubtodo ) { 1012 if ( par == pendingSubtodo ) {
1006 allowReparent = false; 1013 allowReparent = false;
1007 break; 1014 break;
1008 } 1015 }
1009 par = par->parent(); 1016 par = par->parent();
1010 } 1017 }
1011 if ( !allowReparent ) { 1018 if ( !allowReparent ) {
1012 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1019 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1013 qDebug("Recursive reparenting not possible "); 1020 qDebug("Recursive reparenting not possible ");
1014 pendingSubtodo = 0; 1021 pendingSubtodo = 0;
1015 } else { 1022 } else {
1016 Todo* newParent = todoItem->todo(); 1023 Todo* newParent = todoItem->todo();
1017 Todo* newSub = pendingSubtodo->todo(); 1024 Todo* newSub = pendingSubtodo->todo();
1018 pendingSubtodo = 0; 1025 pendingSubtodo = 0;
1019 emit reparentTodoSignal( newParent,newSub ); 1026 emit reparentTodoSignal( newParent,newSub );
1020 return; 1027 return;
1021 } 1028 }
1022 } 1029 }
1023#if 0 1030#if 0
1024 // handled by the item itself 1031 // handled by the item itself
1025 bool completed = todoItem->todo()->isCompleted(); // Completed or not? 1032 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1026 qDebug("com %d ",completed ); 1033 qDebug("com %d ",completed );
1027 qDebug("itemclicked "); 1034 qDebug("itemclicked ");
1028 if (todoItem->isOn()) { 1035 if (todoItem->isOn()) {
1029 qDebug("on "); 1036 qDebug("on ");
1030 if (!completed) { 1037 if (!completed) {
1031 qDebug("set true "); 1038 qDebug("set true ");
1032 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 1039 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1033 } 1040 }
1034 } else { 1041 } else {
1035 qDebug("not on "); 1042 qDebug("not on ");
1036 if (completed) { 1043 if (completed) {
1037 qDebug("set false "); 1044 qDebug("set false ");
1038 todoItem->todo()->setCompleted(false); 1045 todoItem->todo()->setCompleted(false);
1039 } 1046 }
1040 } 1047 }
1041#endif 1048#endif
1042} 1049}
1043 1050
1044void KOTodoView::setDocumentId( const QString &id ) 1051void KOTodoView::setDocumentId( const QString &id )
1045{ 1052{
1046 kdDebug() << "KOTodoView::setDocumentId()" << endl; 1053 kdDebug() << "KOTodoView::setDocumentId()" << endl;
1047 1054
1048 mDocPrefs->setDoc( id ); 1055 mDocPrefs->setDoc( id );
1049} 1056}
1050 1057
1051void KOTodoView::itemStateChanged( QListViewItem *item ) 1058void KOTodoView::itemStateChanged( QListViewItem *item )
1052{ 1059{
1053 if (!item) return; 1060 if (!item) return;
1054 1061
1055 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1062 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1056 1063
1057// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1064// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1058 1065
1059 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1066 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1060} 1067}
1061 1068
1062void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1069void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1063{ 1070{
1064 mTodoListView->saveLayout(config,group); 1071 mTodoListView->saveLayout(config,group);
1065} 1072}
1066 1073
1067void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1074void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1068{ 1075{
1069 mTodoListView->restoreLayout(config,group); 1076 mTodoListView->restoreLayout(config,group);
1070} 1077}
1071 1078
1072void KOTodoView::processSelectionChange() 1079void KOTodoView::processSelectionChange()
1073{ 1080{
1074// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1081// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1075 1082
1076 KOTodoViewItem *item = 1083 KOTodoViewItem *item =
1077 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1084 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1078 1085
1079 if ( !item ) { 1086 if ( !item ) {
1080 emit incidenceSelected( 0 ); 1087 emit incidenceSelected( 0 );
1081 } else { 1088 } else {
1082 emit incidenceSelected( item->todo() ); 1089 emit incidenceSelected( item->todo() );
1083 } 1090 }
1084} 1091}
1085 1092
1086void KOTodoView::modified(bool b) 1093void KOTodoView::modified(bool b)
1087{ 1094{
1088 emit isModified(b); 1095 emit isModified(b);
1089} 1096}
1090void KOTodoView::setTodoModified( Todo* todo ) 1097void KOTodoView::setTodoModified( Todo* todo )
1091{ 1098{
1092 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1099 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1093} 1100}
1094void KOTodoView::clearSelection() 1101void KOTodoView::clearSelection()
1095{ 1102{
1096 mTodoListView->selectAll( false ); 1103 mTodoListView->selectAll( false );