summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp53
-rw-r--r--korganizer/journalentry.h7
-rw-r--r--korganizer/koeditorgeneral.cpp8
-rw-r--r--korganizer/kojournalview.cpp10
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h1
6 files changed, 63 insertions, 26 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 4751d40..56221dc 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,299 +1,328 @@
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// 24//
25// Journal Entry 25// Journal Entry
26 26
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvbox.h> 29#include <qvbox.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qapplication.h> 36#include <qapplication.h>
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <ktextedit.h> 41#include <ktextedit.h>
42#include <kfiledialog.h> 42#include <kfiledialog.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#include <klineedit.h> 45#include <klineedit.h>
46#include <kdialog.h> 46#include <kdialog.h>
47#include "kolocationbox.h" 47#include "kolocationbox.h"
48 48
49#include <libkcal/journal.h> 49#include <libkcal/journal.h>
50#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
51#include <libkcal/resourcecalendar.h> 51#include <libkcal/resourcecalendar.h>
52#include <kresources/resourceselectdialog.h> 52#include <kresources/resourceselectdialog.h>
53 53
54#include "journalentry.h" 54#include "journalentry.h"
55//#include "journalentry.moc" 55//#include "journalentry.moc"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#endif 58#endif
59JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 59JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
60 QFrame(parent) 60 QFrame(parent)
61{ 61{
62 62
63 int fac = 5; 63 int fac = 5;
64 heiHint = QApplication::desktop()->height(); 64 heiHint = QApplication::desktop()->height();
65 if ( heiHint > 800 ) 65 if ( heiHint > 800 )
66 fac += 2; 66 fac += 2;
67 heiHint = heiHint / fac; 67 heiHint = heiHint / fac;
68 68
69 showOnlyMode = false; 69 showOnlyMode = false;
70 mCalendar = calendar; 70 mCalendar = calendar;
71 mJournal = 0; 71 mJournal = 0;
72 visibleMode = true; 72 visibleMode = true;
73 QHBox * vb = new QHBox ( this ); 73 QHBox * vb = new QHBox ( this );
74 QPixmap iconp; 74 QPixmap iconp;
75 vb->setMargin ( KDialog::marginHint()-1 ); 75 vb->setMargin ( KDialog::marginHint()-1 );
76 QPushButton * toggleJournal = new QPushButton( vb ); 76 QPushButton * toggleJournal = new QPushButton( vb );
77 iconp = SmallIcon("1updownarrow"); 77 iconp = SmallIcon("1updownarrow");
78 toggleJournal->setPixmap (iconp ) ; 78 toggleJournal->setPixmap (iconp ) ;
79 new QLabel(" "+i18n("Title: "),vb); 79 new QLabel(" "+i18n("Title: "),vb);
80 mTitle = new KOLocationBox(TRUE, vb, 30); 80 mTitle = new KOLocationBox(TRUE, vb, 30);
81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); 81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) );
82 mTitleLabel = new QLabel(i18n("Title"),vb); 82 mCalendarBox = new QComboBox(vb);
83 mTitleLabel->setMargin(0); 83 //mTitleLabel->setMargin(0);
84 mTitleLabel->setAlignment(AlignCenter); 84 //mTitleLabel->setAlignment(AlignCenter);
85 QPushButton * loadTemplate = new QPushButton( vb ); 85 QPushButton * loadTemplate = new QPushButton( vb );
86 QPushButton * saveTemplate = new QPushButton( vb ); 86 QPushButton * saveTemplate = new QPushButton( vb );
87 if ( QApplication::desktop()->width() < 321 ) 87 if ( QApplication::desktop()->width() < 321 )
88 iconp = SmallIcon("fileexport16"); 88 iconp = SmallIcon("fileexport16");
89 else 89 else
90 iconp = SmallIcon("fileexport"); 90 iconp = SmallIcon("fileexport");
91 saveTemplate->setPixmap (iconp ) ; 91 saveTemplate->setPixmap (iconp ) ;
92 int size = saveTemplate->sizeHint().height(); 92 int size = saveTemplate->sizeHint().height();
93 if ( QApplication::desktop()->width() < 321 ) 93 if ( QApplication::desktop()->width() < 321 )
94 iconp = SmallIcon("fileimport16"); 94 iconp = SmallIcon("fileimport16");
95 else 95 else
96 iconp = SmallIcon("fileimport"); 96 iconp = SmallIcon("fileimport");
97 loadTemplate->setPixmap (iconp ) ; 97 loadTemplate->setPixmap (iconp ) ;
98 loadTemplate->setFixedSize( size, size ); 98 loadTemplate->setFixedSize( size, size );
99 saveTemplate->setFixedSize( size, size ); 99 saveTemplate->setFixedSize( size, size );
100 toggleJournal->setFixedSize( size , size ); 100 toggleJournal->setFixedSize( size , size );
101 mTitle->setMaximumHeight( size+4); 101 mTitle->setMaximumHeight( size+4);
102 mCalendarBox->setMaximumHeight( size+4);
102 mEditor = new KTextEdit(this); 103 mEditor = new KTextEdit(this);
103#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
104 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 105 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
105#endif 106#endif
106 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 107 mEditor->setWordWrap( KTextEdit::WidgetWidth );
107 QBoxLayout *topLayout = new QVBoxLayout(this); 108 QBoxLayout *topLayout = new QVBoxLayout(this);
108 topLayout->addWidget(vb); 109 topLayout->addWidget(vb);
109 topLayout->addWidget(mEditor); 110 topLayout->addWidget(mEditor);
110 mEditor->installEventFilter(this); 111 mEditor->installEventFilter(this);
111 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 112 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
112 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 113 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
113 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 114 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
114 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 115 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
115 mTitle->lineEdit ()->setText(""); 116 mTitle->lineEdit ()->setText("");
116} 117}
117 118
118JournalEntry::~JournalEntry() 119JournalEntry::~JournalEntry()
119{ 120{
120 //qDebug("JournalEntry::~JournalEntry() "); 121 //qDebug("JournalEntry::~JournalEntry() ");
121} 122}
122QSize JournalEntry::sizeHint() const 123QSize JournalEntry::sizeHint() const
123{ 124{
124 return QSize ( 240, heiHint ); 125 return QSize ( 240, heiHint );
125} 126}
126void JournalEntry::slotSaveTemplate() 127void JournalEntry::slotSaveTemplate()
127{ 128{
128 QString fileName =locateLocal( "templates", "journals" ); 129 QString fileName =locateLocal( "templates", "journals" );
129 QDir t_dir; 130 QDir t_dir;
130 if ( !t_dir.exists(fileName) ) 131 if ( !t_dir.exists(fileName) )
131 t_dir.mkdir ( fileName ); 132 t_dir.mkdir ( fileName );
132 fileName += "/journal"; 133 fileName += "/journal";
133 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 134 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
134 if ( fileName.length() == 0 ) 135 if ( fileName.length() == 0 )
135 return; 136 return;
136 137
137 QFile fileIn( fileName ); 138 QFile fileIn( fileName );
138 if (!fileIn.open( IO_WriteOnly ) ) { 139 if (!fileIn.open( IO_WriteOnly ) ) {
139 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 140 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
140 .arg( fileName ) ); 141 .arg( fileName ) );
141 return; 142 return;
142 } 143 }
143 // QString text; 144 // QString text;
144 QTextStream tsIn( &fileIn ); 145 QTextStream tsIn( &fileIn );
145 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 146 tsIn.setCodec( QTextCodec::codecForName("utf8") );
146 tsIn << mEditor->text(); 147 tsIn << mEditor->text();
147 fileIn.close(); 148 fileIn.close();
148} 149}
149void JournalEntry::slotLoadTemplate() 150void JournalEntry::slotLoadTemplate()
150{ 151{
151 QString fileName =locateLocal( "templates", "journals" ); 152 QString fileName =locateLocal( "templates", "journals" );
152 QDir t_dir; 153 QDir t_dir;
153 if ( !t_dir.exists(fileName) ) 154 if ( !t_dir.exists(fileName) )
154 t_dir.mkdir ( fileName ); 155 t_dir.mkdir ( fileName );
155 fileName += "/journal"; 156 fileName += "/journal";
156 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 157 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
157 if ( fileName.length() == 0 ) 158 if ( fileName.length() == 0 )
158 return; 159 return;
159 QFile fileIn( fileName ); 160 QFile fileIn( fileName );
160 if (!fileIn.open( IO_ReadOnly ) ) { 161 if (!fileIn.open( IO_ReadOnly ) ) {
161 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 162 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
162 .arg( fileName ) ); 163 .arg( fileName ) );
163 return; 164 return;
164 } 165 }
165 QTextStream tsIn( &fileIn ); 166 QTextStream tsIn( &fileIn );
166 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 167 tsIn.setCodec( QTextCodec::codecForName("utf8") );
167 QString text = tsIn.read(); 168 QString text = tsIn.read();
168 fileIn.close(); 169 fileIn.close();
169 int line, col; 170 int line, col;
170 mEditor->getCursorPosition (& line, & col ); 171 mEditor->getCursorPosition (& line, & col );
171 mEditor-> insertAt ( text, line, col, true ); 172 mEditor-> insertAt ( text, line, col, true );
172 //mEditor->setIgnoreMark( true ); 173 //mEditor->setIgnoreMark( true );
173} 174}
174void JournalEntry::setDate(const QDate &date) 175void JournalEntry::setDate(const QDate &date)
175{ 176{
176 showOnlyMode = false; 177 showOnlyMode = false;
177 writeJournal(); 178 writeJournal();
178 mDate = date; 179 mDate = date;
179 int id = mCalendar->defaultCalendar(); 180 fillCalendar( mCalendar->defaultCalendar() );
180 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 181}
181 mTitleLabel->setText( " (" + calname +")"); 182void JournalEntry::fillCalendar( int setToID )
183{
184 mCalendarBox->clear();
185 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
186 int std = 0;
187 int count = 0;
188 while ( kkf ) {
189 if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) {
190 if ( setToID ) {
191 if ( kkf->mCalNumber == setToID )
192 std = count;
193 } else {
194 if ( kkf->isStandard ) {
195 std = count;
196 }
197 }
198 ++count;
199 mCalendarBox->insertItem( kkf->mName );
200 }
201 kkf = KOPrefs::instance()->mCalendars.next();
202 }
203 mCalendarBox->setCurrentItem( std );
204 if ( KOPrefs::instance()->mCalendars.count() == 1 )
205 mCalendarBox->hide();
206 else
207 mCalendarBox->show();
182} 208}
183 209
184void JournalEntry::toggleShowJournal() 210void JournalEntry::toggleShowJournal()
185{ 211{
186 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) 212 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty())
187 flushEntry(); 213 flushEntry();
188 if ( showOnlyMode ) 214 if ( showOnlyMode )
189 emit showJournalOnly( 0 ); 215 emit showJournalOnly( 0 );
190 else { 216 else {
191 // we have to protect mJournal from deleting if mJournal has empty text 217 // we have to protect mJournal from deleting if mJournal has empty text
192 visibleMode = false; // set to true via :setShowOnly() 218 visibleMode = false; // set to true via :setShowOnly()
193 emit showJournalOnly( mJournal ); 219 emit showJournalOnly( mJournal );
194 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); 220 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) );
195 } 221 }
196} 222}
197void JournalEntry::setVisibleOn() 223void JournalEntry::setVisibleOn()
198{ 224{
199 visibleMode = true; 225 visibleMode = true;
200} 226}
201void JournalEntry::setShowOnly() 227void JournalEntry::setShowOnly()
202{ 228{
203 showOnlyMode = true; 229 showOnlyMode = true;
204 if ( mTitle->currentText().isEmpty() ) 230 if ( mTitle->currentText().isEmpty() )
205 mTitle->setFocus(); 231 mTitle->setFocus();
206 else 232 else
207 mEditor->setFocus(); 233 mEditor->setFocus();
208} 234}
209void JournalEntry::setJournal(Journal *journal) 235void JournalEntry::setJournal(Journal *journal, bool saveJournal )
210{ 236{
211 writeJournal(); 237 if ( saveJournal )
238 writeJournal();
212 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 239 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
213 240
214 mJournal = journal; 241 mJournal = journal;
215 if ( journal->isReadOnly() ) 242 if ( journal->isReadOnly() )
216 mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); 243 mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")");
217 else 244 else
218 mTitle->lineEdit ()->setText(mJournal->summary()); 245 mTitle->lineEdit ()->setText(mJournal->summary());
219 mEditor->setText(mJournal->description()); 246 mEditor->setText(mJournal->description());
220 mTitle->setEnabled (!journal->isReadOnly() ); 247 mTitle->setEnabled (!journal->isReadOnly() );
221 mEditor->setReadOnly ( journal->isReadOnly() ); 248 mEditor->setReadOnly ( journal->isReadOnly() );
222 int id = mJournal->calID(); 249 fillCalendar( mJournal->calID() );
223
224 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
225 mTitleLabel->setText( " (" + calname +")");
226} 250}
227 251
228Journal *JournalEntry::journal() const 252Journal *JournalEntry::journal() const
229{ 253{
230 return mJournal; 254 return mJournal;
231} 255}
232 256
233 257
234void JournalEntry::clear() 258void JournalEntry::clear()
235{ 259{
236 mJournal = 0; 260 mJournal = 0;
237 mEditor->setText(""); 261 mEditor->setText("");
238 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 262 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
239 mTitle->lineEdit ()->setText(""); 263 mTitle->lineEdit ()->setText("");
240} 264}
241 265
242bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 266bool JournalEntry::eventFilter( QObject *o, QEvent *e )
243{ 267{
244// kdDebug() << "JournalEntry::event received " << e->type() << endl; 268// kdDebug() << "JournalEntry::event received " << e->type() << endl;
245 269
246 if ( e->type() == QEvent::FocusOut ) { 270 if ( e->type() == QEvent::FocusOut ) {
247 writeJournal(); 271 writeJournal();
248 } 272 }
249 if ( e->type() == QEvent::KeyPress ) { 273 if ( e->type() == QEvent::KeyPress ) {
250 QKeyEvent * k = (QKeyEvent *) e; 274 QKeyEvent * k = (QKeyEvent *) e;
251 if ( k->state() == Qt::ControlButton ) { 275 if ( k->state() == Qt::ControlButton ) {
252 k->ignore(); 276 k->ignore();
253 //return true; 277 //return true;
254 } 278 }
255 } 279 }
256 280
257 return QFrame::eventFilter( o, e ); // standard event processing 281 return QFrame::eventFilter( o, e ); // standard event processing
258} 282}
259 283
260void JournalEntry::writeJournal() 284void JournalEntry::writeJournal()
261{ 285{
262 if ( !visibleMode ) return; 286 if ( !visibleMode ) return;
287 if ( !mTitle->isEnabled() ) return;
263 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { 288 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
264 if ( mJournal ) { 289 if ( mJournal ) {
265 Journal* j = mJournal; 290 Journal* j = mJournal;
266 mJournal = 0; 291 mJournal = 0;
267 bool conf = KOPrefs::instance()->mConfirm; 292 bool conf = KOPrefs::instance()->mConfirm;
268 KOPrefs::instance()->mConfirm = false; 293 KOPrefs::instance()->mConfirm = false;
269 emit deleteJournal(j); 294 emit deleteJournal(j);
270 KOPrefs::instance()->mConfirm = conf; 295 KOPrefs::instance()->mConfirm = conf;
271 } 296 }
272 return; 297 return;
273 } 298 }
274 299
275// kdDebug() << "JournalEntry::writeJournal()..." << endl; 300// kdDebug() << "JournalEntry::writeJournal()..." << endl;
276 301
277 if (!mJournal) { 302 if (!mJournal) {
278 mJournal = new Journal; 303 mJournal = new Journal;
279 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 304 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
280 mCalendar->addJournal(mJournal); 305 mCalendar->addJournal(mJournal);
281 } 306 }
282 if ( mJournal->description() != mEditor->text() ) { 307 if ( mJournal->description() != mEditor->text() ) {
283 mJournal->setDescription(mEditor->text()); 308 mJournal->setDescription(mEditor->text());
284 } 309 }
285 if ( mJournal->summary() != mTitle->currentText() ) { 310 if ( mJournal->summary() != mTitle->currentText() ) {
286 mJournal->setSummary(mTitle->currentText()); 311 mJournal->setSummary(mTitle->currentText());
287 mTitle->save(KOLocationBox::SUMMARYJOURNAL); 312 mTitle->save(KOLocationBox::SUMMARYJOURNAL);
288 } 313 }
314 int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() );
315 if ( mJournal->calID() != id ) {
316 mJournal->setCalID( id );
317 }
289} 318}
290 319
291void JournalEntry::flushEntry() 320void JournalEntry::flushEntry()
292{ 321{
293 writeJournal(); 322 writeJournal();
294} 323}
295void JournalEntry::keyPressEvent ( QKeyEvent * e ) 324void JournalEntry::keyPressEvent ( QKeyEvent * e )
296{ 325{
297 e->ignore(); 326 e->ignore();
298 327
299} 328}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index fb19fb1..ed04b7c 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -1,85 +1,86 @@
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#ifndef JOURNALENTRY_H 23#ifndef JOURNALENTRY_H
24#define JOURNALENTRY_H 24#define JOURNALENTRY_H
25// 25//
26// Widget showing one Journal entry 26// Widget showing one Journal entry
27 27
28#include <qframe.h> 28#include <qframe.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32class QLabel; 32class QLabel;
33class KTextEdit; 33class KTextEdit;
34class QComboBox;
34class KLineEdit; 35class KLineEdit;
35class KOLocationBox; 36class KOLocationBox;
36 37
37using namespace KCal; 38using namespace KCal;
38 39
39class JournalEntry : public QFrame { 40class JournalEntry : public QFrame {
40 Q_OBJECT 41 Q_OBJECT
41 public: 42 public:
42 JournalEntry(Calendar *,QWidget *parent); 43 JournalEntry(Calendar *,QWidget *parent);
43 virtual ~JournalEntry(); 44 virtual ~JournalEntry();
44 45
45 void setJournal(Journal *); 46 void setJournal(Journal *, bool saveJournal = true );
46 Journal *journal() const; 47 Journal *journal() const;
47 48
48 void setDate(const QDate &); 49 void setDate(const QDate &);
49 50
50 void clear(); 51 void clear();
51 52
52 void flushEntry(); 53 void flushEntry();
53 void setShowOnly(); 54 void setShowOnly();
54 QSize sizeHint() const; 55 QSize sizeHint() const;
55 void setVisibleMode( bool b ) { visibleMode = b;} 56 void setVisibleMode( bool b ) { visibleMode = b;}
56 57 void fillCalendar( int id = 0 );
57 protected slots: 58 protected slots:
58 void slotSaveTemplate(); 59 void slotSaveTemplate();
59 void slotLoadTemplate(); 60 void slotLoadTemplate();
60 void toggleShowJournal(); 61 void toggleShowJournal();
61 void setVisibleOn(); 62 void setVisibleOn();
62 signals: 63 signals:
63 void deleteJournal(Journal *); 64 void deleteJournal(Journal *);
64 void newJournal(); 65 void newJournal();
65 void showJournalOnly( Journal * ); 66 void showJournalOnly( Journal * );
66 67
67 protected: 68 protected:
68 bool eventFilter( QObject *o, QEvent *e ); 69 bool eventFilter( QObject *o, QEvent *e );
69 70
70 void writeJournal(); 71 void writeJournal();
71 72
72 private: 73 private:
73 bool visibleMode; 74 bool visibleMode;
74 bool showOnlyMode; 75 bool showOnlyMode;
75 Calendar *mCalendar; 76 Calendar *mCalendar;
76 Journal *mJournal; 77 Journal *mJournal;
77 QDate mDate; 78 QDate mDate;
78 void keyPressEvent ( QKeyEvent * ) ; 79 void keyPressEvent ( QKeyEvent * ) ;
79 QLabel *mTitleLabel; 80 QComboBox *mCalendarBox;
80 KOLocationBox * mTitle; 81 KOLocationBox * mTitle;
81 KTextEdit *mEditor; 82 KTextEdit *mEditor;
82 int heiHint; 83 int heiHint;
83}; 84};
84 85
85#endif 86#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index fd50b05..aa55d82 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -230,395 +230,389 @@ void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
230 mDescriptionEdit->append(""); 230 mDescriptionEdit->append("");
231 mDescriptionEdit->setReadOnly(false); 231 mDescriptionEdit->setReadOnly(false);
232 mDescriptionEdit->setOverwriteMode(false); 232 mDescriptionEdit->setOverwriteMode(false);
233 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 233 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
234 topLayout->addWidget(mDescriptionEdit); 234 topLayout->addWidget(mDescriptionEdit);
235#ifndef DESKTOP_VERSION 235#ifndef DESKTOP_VERSION
236 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 236 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
237#endif 237#endif
238 238
239} 239}
240 240
241void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 241void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
242{ 242{
243 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 243 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
244 244
245 //mAlarmBell = new QLabel(parent); 245 //mAlarmBell = new QLabel(parent);
246 //mAlarmBell->setPixmap(SmallIcon("bell")); 246 //mAlarmBell->setPixmap(SmallIcon("bell"));
247 //alarmLayout->addWidget(mAlarmBell); 247 //alarmLayout->addWidget(mAlarmBell);
248 if ( QApplication::desktop()->width() < 320 ) 248 if ( QApplication::desktop()->width() < 320 )
249 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 249 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
250 else 250 else
251 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 251 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
252 252
253 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 253 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
254 alarmLayout->addWidget(mAlarmButton); 254 alarmLayout->addWidget(mAlarmButton);
255 255
256 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 256 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
257 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 257 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
258 alarmLayout->addWidget(mAlarmTimeEdit); 258 alarmLayout->addWidget(mAlarmTimeEdit);
259 mAlarmIncrCombo = new QComboBox(false, parent); 259 mAlarmIncrCombo = new QComboBox(false, parent);
260 if ( QApplication::desktop()->width() < 320 ) { 260 if ( QApplication::desktop()->width() < 320 ) {
261 mAlarmIncrCombo->insertItem(i18n("min")); 261 mAlarmIncrCombo->insertItem(i18n("min"));
262 mAlarmIncrCombo->insertItem(i18n("hou")); 262 mAlarmIncrCombo->insertItem(i18n("hou"));
263 mAlarmIncrCombo->insertItem(i18n("day")); 263 mAlarmIncrCombo->insertItem(i18n("day"));
264 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 264 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
265 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 265 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
266 } else { 266 } else {
267 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 267 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
268 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 268 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
269 mAlarmIncrCombo->insertItem(i18n("day(s)")); 269 mAlarmIncrCombo->insertItem(i18n("day(s)"));
270 } 270 }
271 271
272 // mAlarmIncrCombo->setMinimumHeight(20); 272 // mAlarmIncrCombo->setMinimumHeight(20);
273 alarmLayout->addWidget(mAlarmIncrCombo); 273 alarmLayout->addWidget(mAlarmIncrCombo);
274 mAlarmSoundButton = new QPushButton(parent); 274 mAlarmSoundButton = new QPushButton(parent);
275 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 275 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
276 mAlarmSoundButton->setToggleButton(true); 276 mAlarmSoundButton->setToggleButton(true);
277 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 277 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
278 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 278 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
279 alarmLayout->addWidget(mAlarmSoundButton); 279 alarmLayout->addWidget(mAlarmSoundButton);
280 280
281 mAlarmProgramButton = new QPushButton(parent); 281 mAlarmProgramButton = new QPushButton(parent);
282 mAlarmProgramButton->setPixmap(SmallIcon("run")); 282 mAlarmProgramButton->setPixmap(SmallIcon("run"));
283 mAlarmProgramButton->setToggleButton(true); 283 mAlarmProgramButton->setToggleButton(true);
284 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 284 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
285 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 285 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
286 alarmLayout->addWidget(mAlarmProgramButton); 286 alarmLayout->addWidget(mAlarmProgramButton);
287 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 287 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
288 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 288 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
289 // if ( KOPrefs::instance()->mCompactDialogs ) { 289 // if ( KOPrefs::instance()->mCompactDialogs ) {
290 // mAlarmSoundButton->hide(); 290 // mAlarmSoundButton->hide();
291 // mAlarmProgramButton->hide(); 291 // mAlarmProgramButton->hide();
292 // } 292 // }
293} 293}
294 294
295void KOEditorGeneral::pickAlarmSound() 295void KOEditorGeneral::pickAlarmSound()
296{ 296{
297 297
298 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 298 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
299 299
300 bool oldState = mAlarmSoundButton->isOn(); 300 bool oldState = mAlarmSoundButton->isOn();
301 301
302 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 302 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
303 i18n("*.wav|Wav Files"), 0)); 303 i18n("*.wav|Wav Files"), 0));
304 if (!fileName.isEmpty()) { 304 if (!fileName.isEmpty()) {
305 mAlarmSound = fileName; 305 mAlarmSound = fileName;
306 QToolTip::remove(mAlarmSoundButton); 306 QToolTip::remove(mAlarmSoundButton);
307 QString dispStr = i18n("Playing '%1'").arg(fileName); 307 QString dispStr = i18n("Playing '%1'").arg(fileName);
308 QToolTip::add(mAlarmSoundButton, dispStr); 308 QToolTip::add(mAlarmSoundButton, dispStr);
309 mAlarmProgramButton->setOn(false); 309 mAlarmProgramButton->setOn(false);
310 mAlarmSoundButton->setOn(true); 310 mAlarmSoundButton->setOn(true);
311 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 311 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
312 } else { 312 } else {
313 mAlarmProgramButton->setOn(oldState); 313 mAlarmProgramButton->setOn(oldState);
314 mAlarmSoundButton->setOn(!oldState); 314 mAlarmSoundButton->setOn(!oldState);
315 315
316 316
317 } 317 }
318 318
319 if (mAlarmProgramButton->isOn()) 319 if (mAlarmProgramButton->isOn())
320 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 320 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
321 if ( mAlarmSoundButton->isOn()) 321 if ( mAlarmSoundButton->isOn())
322 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 322 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
323 323
324} 324}
325 325
326void KOEditorGeneral::pickAlarmProgram() 326void KOEditorGeneral::pickAlarmProgram()
327{ 327{
328 bool oldState = mAlarmProgramButton->isOn(); 328 bool oldState = mAlarmProgramButton->isOn();
329 329
330 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); 330 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
331 if (!fileName.isEmpty()) { 331 if (!fileName.isEmpty()) {
332 mAlarmProgram = fileName; 332 mAlarmProgram = fileName;
333 QToolTip::remove(mAlarmProgramButton); 333 QToolTip::remove(mAlarmProgramButton);
334 QString dispStr = i18n("Running '%1'").arg(fileName); 334 QString dispStr = i18n("Running '%1'").arg(fileName);
335 QToolTip::add(mAlarmProgramButton, dispStr); 335 QToolTip::add(mAlarmProgramButton, dispStr);
336 mAlarmSoundButton->setOn(false); 336 mAlarmSoundButton->setOn(false);
337 mAlarmProgramButton->setOn(true); 337 mAlarmProgramButton->setOn(true);
338 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 338 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
339 } else { 339 } else {
340 mAlarmProgramButton->setOn(!oldState); 340 mAlarmProgramButton->setOn(!oldState);
341 mAlarmSoundButton->setOn(oldState); 341 mAlarmSoundButton->setOn(oldState);
342 } 342 }
343 343
344 if (mAlarmProgramButton->isOn()) 344 if (mAlarmProgramButton->isOn())
345 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 345 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
346 if ( mAlarmSoundButton->isOn()) 346 if ( mAlarmSoundButton->isOn())
347 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 347 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
348 348
349} 349}
350 350
351 351
352QString KOEditorGeneral::getFittingPath( const QString s ) 352QString KOEditorGeneral::getFittingPath( const QString s )
353{ 353{
354 int maxlen = 50; 354 int maxlen = 50;
355 if ( QApplication::desktop()->width() < 640 ) { 355 if ( QApplication::desktop()->width() < 640 ) {
356 if ( QApplication::desktop()->width() < 320 ) 356 if ( QApplication::desktop()->width() < 320 )
357 maxlen = 22; 357 maxlen = 22;
358 else 358 else
359 maxlen = 35; 359 maxlen = 35;
360 } 360 }
361 if ( s.length() > maxlen ) { 361 if ( s.length() > maxlen ) {
362 return "..."+s.right(maxlen -3); 362 return "..."+s.right(maxlen -3);
363 } 363 }
364 return s; 364 return s;
365} 365}
366 366
367void KOEditorGeneral::enableAlarmEdit(bool enable) 367void KOEditorGeneral::enableAlarmEdit(bool enable)
368{ 368{
369 if ( enable ) { 369 if ( enable ) {
370 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 370 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
371 mAlarmSoundButton->setOn( true ); 371 mAlarmSoundButton->setOn( true );
372 if ( mAlarmSound.isEmpty() ) 372 if ( mAlarmSound.isEmpty() )
373 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 373 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
374 else { 374 else {
375 if ( ! QFile::exists( mAlarmSound ) ) 375 if ( ! QFile::exists( mAlarmSound ) )
376 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 376 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
377 } 377 }
378 } 378 }
379 } 379 }
380 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); 380 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
381 mAlarmTimeEdit->setEnabled(enable); 381 mAlarmTimeEdit->setEnabled(enable);
382 mAlarmSoundButton->setEnabled(enable); 382 mAlarmSoundButton->setEnabled(enable);
383 mAlarmProgramButton->setEnabled(enable); 383 mAlarmProgramButton->setEnabled(enable);
384 mAlarmIncrCombo->setEnabled(enable); 384 mAlarmIncrCombo->setEnabled(enable);
385} 385}
386 386
387void KOEditorGeneral::disableAlarmEdit(bool disable) 387void KOEditorGeneral::disableAlarmEdit(bool disable)
388{ 388{
389 enableAlarmEdit( !disable ); 389 enableAlarmEdit( !disable );
390} 390}
391 391
392void KOEditorGeneral::enableAlarm( bool enable ) 392void KOEditorGeneral::enableAlarm( bool enable )
393{ 393{
394 enableAlarmEdit( enable ); 394 enableAlarmEdit( enable );
395} 395}
396 396
397void KOEditorGeneral::alarmDisable(bool disable) 397void KOEditorGeneral::alarmDisable(bool disable)
398{ 398{
399 if (!disable) { 399 if (!disable) {
400 //mAlarmBell->setEnabled(true); 400 //mAlarmBell->setEnabled(true);
401 mAlarmButton->setEnabled(true); 401 mAlarmButton->setEnabled(true);
402 } else { 402 } else {
403 //mAlarmBell->setEnabled(false); 403 //mAlarmBell->setEnabled(false);
404 mAlarmButton->setEnabled(false); 404 mAlarmButton->setEnabled(false);
405 mAlarmButton->setChecked(false); 405 mAlarmButton->setChecked(false);
406 mAlarmTimeEdit->setEnabled(false); 406 mAlarmTimeEdit->setEnabled(false);
407 mAlarmSoundButton->setEnabled(false); 407 mAlarmSoundButton->setEnabled(false);
408 mAlarmProgramButton->setEnabled(false); 408 mAlarmProgramButton->setEnabled(false);
409 mAlarmIncrCombo->setEnabled(false); 409 mAlarmIncrCombo->setEnabled(false);
410 } 410 }
411} 411}
412 412
413void KOEditorGeneral::setCategories(const QString &str) 413void KOEditorGeneral::setCategories(const QString &str)
414{ 414{
415 QString tt = str; 415 QString tt = str;
416 QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); 416 QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>");
417 mCategoriesLabel->setText(str); 417 mCategoriesLabel->setText(str);
418} 418}
419 419
420void KOEditorGeneral::setDefaults(bool allDay) 420void KOEditorGeneral::setDefaults(bool allDay)
421{ 421{
422#if 0 422#if 0
423 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); 423 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName());
424#endif 424#endif
425 425
426 mAlarmMessage = i18n("Edit new item"); 426 mAlarmMessage = i18n("Edit new item");
427 enableAlarmEdit( !allDay ); 427 enableAlarmEdit( !allDay );
428 428
429 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 429 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
430 int alarmTime; 430 int alarmTime;
431 int a[] = { 1,5,10,15,30,60,180, 1440 }; 431 int a[] = { 1,5,10,15,30,60,180, 1440 };
432 int index = KOPrefs::instance()->mAlarmTime; 432 int index = KOPrefs::instance()->mAlarmTime;
433 if (index < 0 || index > 7) { 433 if (index < 0 || index > 7) {
434 alarmTime = 15; 434 alarmTime = 15;
435 } else { 435 } else {
436 alarmTime = a[index]; 436 alarmTime = a[index];
437 } 437 }
438 mAlarmButton ->setChecked( false ); 438 mAlarmButton ->setChecked( false );
439 mAlarmTimeEdit->setValue(alarmTime); 439 mAlarmTimeEdit->setValue(alarmTime);
440 mAlarmIncrCombo->setCurrentItem(0); 440 mAlarmIncrCombo->setCurrentItem(0);
441 enableAlarmEdit( false ); 441 enableAlarmEdit( false );
442 //alarmDisable (false); 442 //alarmDisable (false);
443 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); 443 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic);
444 mCancelBox->setChecked( false ); 444 mCancelBox->setChecked( false );
445 mSummaryEdit->setEditText(""); 445 mSummaryEdit->setEditText("");
446 mLocationEdit->setEditText(""); 446 mLocationEdit->setEditText("");
447 mDescriptionEdit->setText(""); 447 mDescriptionEdit->setText("");
448 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 448 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
449 setCategories(""); 449 setCategories("");
450 fillCalCombo(); 450 fillCalCombo();
451} 451}
452void KOEditorGeneral::setSecrecy( int num ) 452void KOEditorGeneral::setSecrecy( int num )
453{ 453{
454 mSecrecyCombo->setCurrentItem(num); 454 mSecrecyCombo->setCurrentItem(num);
455} 455}
456void KOEditorGeneral::fillCalCombo( int setToID ) 456void KOEditorGeneral::fillCalCombo( int setToID )
457{ 457{
458 mCalendarBox->clear(); 458 mCalendarBox->clear();
459 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 459 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
460 int std = 0; 460 int std = 0;
461 int count = 0; 461 int count = 0;
462 while ( kkf ) { 462 while ( kkf ) {
463 if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { 463 if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) {
464 if ( setToID ) { 464 if ( setToID ) {
465 if ( kkf->mCalNumber == setToID ) 465 if ( kkf->mCalNumber == setToID )
466 std = count; 466 std = count;
467 } else { 467 } else {
468 if ( kkf->isStandard ) { 468 if ( kkf->isStandard ) {
469 std = count; 469 std = count;
470 } 470 }
471 } 471 }
472 ++count; 472 ++count;
473 mCalendarBox->insertItem( kkf->mName ); 473 mCalendarBox->insertItem( kkf->mName );
474 } 474 }
475 kkf = KOPrefs::instance()->mCalendars.next(); 475 kkf = KOPrefs::instance()->mCalendars.next();
476 } 476 }
477 mCalendarBox->setCurrentItem( std ); 477 mCalendarBox->setCurrentItem( std );
478 if ( KOPrefs::instance()->mCalendars.count() == 1 ) 478 if ( KOPrefs::instance()->mCalendars.count() == 1 )
479 mCalendarBox->hide(); 479 mCalendarBox->hide();
480 else 480 else
481 mCalendarBox->show(); 481 mCalendarBox->show();
482 482
483} 483}
484int KOEditorGeneral::getCalendarID() 484int KOEditorGeneral::getCalendarID()
485{ 485{
486 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 486 return KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() );
487 while ( kkf ) {
488 if ( mCalendarBox->currentText() == kkf->mName)
489 return kkf->mCalNumber;
490 kkf = KOPrefs::instance()->mCalendars.next();
491 }
492 return 1;
493} 487}
494 488
495void KOEditorGeneral::readIncidence(Incidence *event) 489void KOEditorGeneral::readIncidence(Incidence *event)
496{ 490{
497 fillCalCombo( event->calID() ); 491 fillCalCombo( event->calID() );
498 mAlarmMessage = event->summary(); 492 mAlarmMessage = event->summary();
499 if ( ! event->location().isEmpty() ) 493 if ( ! event->location().isEmpty() )
500 mAlarmMessage += " ("+event->location()+")"; 494 mAlarmMessage += " ("+event->location()+")";
501 mAlarmIncrCombo->setCurrentItem(0); 495 mAlarmIncrCombo->setCurrentItem(0);
502 mSummaryEdit->setEditText(event->summary()); 496 mSummaryEdit->setEditText(event->summary());
503 mLocationEdit->setEditText(event->location()); 497 mLocationEdit->setEditText(event->location());
504 mDescriptionEdit->setText(event->description()); 498 mDescriptionEdit->setText(event->description());
505 499
506#if 0 500#if 0
507 // organizer information 501 // organizer information
508 mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); 502 mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
509#endif 503#endif
510 504
511 enableAlarmEdit( event->isAlarmEnabled() ); 505 enableAlarmEdit( event->isAlarmEnabled() );
512 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); 506 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
513 if(!event->isAlarmEnabled()) { 507 if(!event->isAlarmEnabled()) {
514 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 508 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
515 int alarmTime; 509 int alarmTime;
516 int a[] = { 1,5,10,15,30,60,180, 1440 }; 510 int a[] = { 1,5,10,15,30,60,180, 1440 };
517 int index = KOPrefs::instance()->mAlarmTime; 511 int index = KOPrefs::instance()->mAlarmTime;
518 if (index < 0 || index > 7) { 512 if (index < 0 || index > 7) {
519 alarmTime = 15; 513 alarmTime = 15;
520 } else { 514 } else {
521 alarmTime = a[index]; 515 alarmTime = a[index];
522 } 516 }
523 mAlarmTimeEdit->setValue(alarmTime); 517 mAlarmTimeEdit->setValue(alarmTime);
524 } 518 }
525 mAlarmButton->setChecked( event->isAlarmEnabled() ); 519 mAlarmButton->setChecked( event->isAlarmEnabled() );
526 mSecrecyCombo->setCurrentItem(event->secrecy()); 520 mSecrecyCombo->setCurrentItem(event->secrecy());
527 mCancelBox->setChecked( event->cancelled() ); 521 mCancelBox->setChecked( event->cancelled() );
528 mAlarmProgramButton->setOn(false); 522 mAlarmProgramButton->setOn(false);
529 mAlarmSoundButton->setOn(false); 523 mAlarmSoundButton->setOn(false);
530 524
531 // set up alarm stuff 525 // set up alarm stuff
532 QPtrList<Alarm> alarms = event->alarms(); 526 QPtrList<Alarm> alarms = event->alarms();
533 Alarm* alarm; 527 Alarm* alarm;
534 mAlarmIncrCombo->setCurrentItem(0); 528 mAlarmIncrCombo->setCurrentItem(0);
535 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 529 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
536 int offset; 530 int offset;
537 if ( alarm->hasTime() ) { 531 if ( alarm->hasTime() ) {
538 QDateTime t = alarm->time(); 532 QDateTime t = alarm->time();
539 offset = event->dtStart().secsTo( t ); 533 offset = event->dtStart().secsTo( t );
540 } else { 534 } else {
541 offset = alarm->startOffset().asSeconds(); 535 offset = alarm->startOffset().asSeconds();
542 } 536 }
543 if ( offset != 0 ) { 537 if ( offset != 0 ) {
544 offset = offset / -60; // make minutes 538 offset = offset / -60; // make minutes
545 if (offset % 60 == 0) { // divides evenly into hours? 539 if (offset % 60 == 0) { // divides evenly into hours?
546 offset = offset / 60; 540 offset = offset / 60;
547 mAlarmIncrCombo->setCurrentItem(1); 541 mAlarmIncrCombo->setCurrentItem(1);
548 if (offset % 24 == 0) { // divides evenly into days? 542 if (offset % 24 == 0) { // divides evenly into days?
549 offset = offset / 24; 543 offset = offset / 24;
550 mAlarmIncrCombo->setCurrentItem(2); 544 mAlarmIncrCombo->setCurrentItem(2);
551 } 545 }
552 } 546 }
553 } 547 }
554 mAlarmTimeEdit->setValue( offset ); 548 mAlarmTimeEdit->setValue( offset );
555 if (alarm->type() == Alarm::Procedure) { 549 if (alarm->type() == Alarm::Procedure) {
556 550
557 mAlarmProgram = alarm->programFile(); 551 mAlarmProgram = alarm->programFile();
558 mAlarmProgramButton->setOn(true); 552 mAlarmProgramButton->setOn(true);
559 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 553 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
560 QToolTip::add(mAlarmProgramButton, dispStr); 554 QToolTip::add(mAlarmProgramButton, dispStr);
561 } 555 }
562 else if (alarm->type() == Alarm::Audio) { 556 else if (alarm->type() == Alarm::Audio) {
563 mAlarmSound = alarm->audioFile(); 557 mAlarmSound = alarm->audioFile();
564 if ( ! QFile::exists( mAlarmSound ) ) 558 if ( ! QFile::exists( mAlarmSound ) )
565 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 559 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
566 mAlarmSoundButton->setOn(true); 560 mAlarmSoundButton->setOn(true);
567 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 561 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
568 QToolTip::add(mAlarmSoundButton, dispStr); 562 QToolTip::add(mAlarmSoundButton, dispStr);
569 } 563 }
570 mAlarmButton->setChecked(alarm->enabled()); 564 mAlarmButton->setChecked(alarm->enabled());
571 enableAlarmEdit( alarm->enabled() ); 565 enableAlarmEdit( alarm->enabled() );
572 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 566 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
573 // TODO: Deal with multiple alarms 567 // TODO: Deal with multiple alarms
574 break; // For now, stop after the first alarm 568 break; // For now, stop after the first alarm
575 } 569 }
576 570
577 setCategories(event->categoriesStr()); 571 setCategories(event->categoriesStr());
578} 572}
579 573
580void KOEditorGeneral::writeIncidence(Incidence *event) 574void KOEditorGeneral::writeIncidence(Incidence *event)
581{ 575{
582 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 576 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
583 mLocationEdit->save(KOLocationBox::LOCATION); 577 mLocationEdit->save(KOLocationBox::LOCATION);
584 event->setSummary(mSummaryEdit->currentText()); 578 event->setSummary(mSummaryEdit->currentText());
585 event->setLocation(mLocationEdit->currentText()); 579 event->setLocation(mLocationEdit->currentText());
586 event->setDescription(mDescriptionEdit->text()); 580 event->setDescription(mDescriptionEdit->text());
587 event->setCategories(mCategoriesLabel->text()); 581 event->setCategories(mCategoriesLabel->text());
588 event->setSecrecy(mSecrecyCombo->currentItem()); 582 event->setSecrecy(mSecrecyCombo->currentItem());
589 event->setCancelled(mCancelBox->isChecked() );; 583 event->setCancelled(mCancelBox->isChecked() );;
590 // alarm stuff 584 // alarm stuff
591 if (mAlarmButton->isChecked()) { 585 if (mAlarmButton->isChecked()) {
592 if (event->alarms().count() == 0) 586 if (event->alarms().count() == 0)
593 event->newAlarm(); 587 event->newAlarm();
594 QPtrList<Alarm> alarms = event->alarms(); 588 QPtrList<Alarm> alarms = event->alarms();
595 Alarm *alarm; 589 Alarm *alarm;
596 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 590 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
597 alarm->setEnabled(true); 591 alarm->setEnabled(true);
598 int j = mAlarmTimeEdit->value()* -60; 592 int j = mAlarmTimeEdit->value()* -60;
599 if (mAlarmIncrCombo->currentItem() == 1) 593 if (mAlarmIncrCombo->currentItem() == 1)
600 j = j * 60; 594 j = j * 60;
601 else if (mAlarmIncrCombo->currentItem() == 2) 595 else if (mAlarmIncrCombo->currentItem() == 2)
602 j = j * (60 * 24); 596 j = j * (60 * 24);
603 alarm->setStartOffset( j ); 597 alarm->setStartOffset( j );
604 598
605 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { 599 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
606 alarm->setProcedureAlarm(mAlarmProgram); 600 alarm->setProcedureAlarm(mAlarmProgram);
607 } 601 }
608 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 602 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
609 alarm->setAudioAlarm(mAlarmSound); 603 alarm->setAudioAlarm(mAlarmSound);
610 else 604 else
611 alarm->setType(Alarm::Invalid); 605 alarm->setType(Alarm::Invalid);
612 //alarm->setAudioAlarm("default"); 606 //alarm->setAudioAlarm("default");
613 // TODO: Deal with multiple alarms 607 // TODO: Deal with multiple alarms
614 break; // For now, stop after the first alarm 608 break; // For now, stop after the first alarm
615 } 609 }
616 } else { 610 } else {
617 Alarm* alarm = event->alarms().first(); 611 Alarm* alarm = event->alarms().first();
618 if ( alarm ) { 612 if ( alarm ) {
619 alarm->setEnabled(false); 613 alarm->setEnabled(false);
620 alarm->setType(Alarm::Invalid); 614 alarm->setType(Alarm::Invalid);
621 } 615 }
622 } 616 }
623 event->setCalID( getCalendarID() ); 617 event->setCalID( getCalendarID() );
624} 618}
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 9b0e748..0523954 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,235 +1,237 @@
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// 24//
25// View of Journal entries 25// View of Journal entries
26 26
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qscrollview.h> 28#include <qscrollview.h>
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qhbox.h> 30#include <qhbox.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qapplication.h> 34#include <qapplication.h>
35 35
36#include <klocale.h> 36#include <klocale.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include "koprefs.h" 38#include "koprefs.h"
39#include <kglobal.h> 39#include <kglobal.h>
40 40
41#include <libkcal/calendar.h> 41#include <libkcal/calendar.h>
42 42
43#include "journalentry.h" 43#include "journalentry.h"
44 44
45#include "kojournalview.h" 45#include "kojournalview.h"
46using namespace KOrg; 46using namespace KOrg;
47 47
48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
49 const char *name) 49 const char *name)
50 : KOrg::BaseView(calendar, parent, name) 50 : KOrg::BaseView(calendar, parent, name)
51{ 51{
52 mCalendar = calendar; 52 mCalendar = calendar;
53 QHBox * vb = new QHBox ( this ); 53 QHBox * vb = new QHBox ( this );
54 QPushButton * newJournal = new QPushButton( vb ); 54 QPushButton * newJournal = new QPushButton( vb );
55 QPixmap icon; 55 QPixmap icon;
56 if ( QApplication::desktop()->width() < 321 ) 56 if ( QApplication::desktop()->width() < 321 )
57 icon = SmallIcon("ko16old"); 57 icon = SmallIcon("ko16old");
58 else 58 else
59 icon = SmallIcon("ko24old"); 59 icon = SmallIcon("ko24old");
60 newJournal->setPixmap (icon ) ; 60 newJournal->setPixmap (icon ) ;
61 int size = newJournal->sizeHint().height(); 61 int size = newJournal->sizeHint().height();
62 newJournal->setFixedSize( size, size ); 62 newJournal->setFixedSize( size, size );
63 mDateLabel = new QLabel ( vb ); 63 mDateLabel = new QLabel ( vb );
64 mDateLabel->setMargin(1); 64 mDateLabel->setMargin(1);
65 mDateLabel->setAlignment(AlignCenter); 65 mDateLabel->setAlignment(AlignCenter);
66 QScrollView * sv = new QScrollView( this ); 66 QScrollView * sv = new QScrollView( this );
67 QVBoxLayout * hbl = new QVBoxLayout( this ); 67 QVBoxLayout * hbl = new QVBoxLayout( this );
68 hbl->addWidget( vb ); 68 hbl->addWidget( vb );
69 hbl->addWidget( sv ); 69 hbl->addWidget( sv );
70 parWid = new QWidget( sv->viewport() ); 70 parWid = new QWidget( sv->viewport() );
71 sv->addChild(parWid); 71 sv->addChild(parWid);
72 sv->setResizePolicy( QScrollView:: AutoOneFit ); 72 sv->setResizePolicy( QScrollView:: AutoOneFit );
73 mTopLayout = new QVBoxLayout(parWid); 73 mTopLayout = new QVBoxLayout(parWid);
74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); 74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
75 getNewEntry(); 75 getNewEntry();
76} 76}
77 77
78KOJournalView::~KOJournalView() 78KOJournalView::~KOJournalView()
79{ 79{
80} 80}
81 81
82int KOJournalView::currentDateCount() 82int KOJournalView::currentDateCount()
83{ 83{
84 return 0; 84 return 0;
85} 85}
86JournalEntry* KOJournalView::getNewEntry() 86JournalEntry* KOJournalView::getNewEntry()
87{ 87{
88 JournalEntry* Entry = new JournalEntry(mCalendar,parWid); 88 JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
89 jEntries.append( Entry ); 89 jEntries.append( Entry );
90 mTopLayout->addWidget(Entry); 90 mTopLayout->addWidget(Entry);
91 Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); 91 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
92 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 92 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
93 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; 93 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
94 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; 94 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
95 return Entry; 95 return Entry;
96} 96}
97 97
98QPtrList<Incidence> KOJournalView::selectedIncidences() 98QPtrList<Incidence> KOJournalView::selectedIncidences()
99{ 99{
100 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
101 101
102 return eventList; 102 return eventList;
103} 103}
104void KOJournalView::updateConfig() 104void KOJournalView::updateConfig()
105{ 105{
106 JournalEntry* mEntry = jEntries.first(); 106 JournalEntry* mEntry = jEntries.first();
107 while ( mEntry ) { 107 while ( mEntry ) {
108 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 108 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
109 mEntry = jEntries.next(); 109 mEntry = jEntries.next();
110 } 110 }
111} 111}
112void KOJournalView::updateView() 112void KOJournalView::updateView()
113{ 113{
114 JournalEntry* mEntry = jEntries.first(); 114 JournalEntry* mEntry = jEntries.first();
115 while ( mEntry ) { 115 while ( mEntry ) {
116 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 116 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
117 mEntry = jEntries.next(); 117 mEntry = jEntries.next();
118 } 118 }
119 showDates( mDate, QDate() ); 119 showDates( mDate, QDate() );
120} 120}
121void KOJournalView::checkModified() 121void KOJournalView::checkModified()
122{ 122{
123 flushView(); 123 flushView();
124} 124}
125void KOJournalView::flushView() 125void KOJournalView::flushView()
126{ 126{
127 static bool ff = false; 127 static bool ff = false;
128 if ( ff ) return; 128 if ( ff ) return;
129 ff = true; 129 ff = true;
130 JournalEntry* mEntry = jEntries.first(); 130 JournalEntry* mEntry = jEntries.first();
131 while ( mEntry ) { 131 while ( mEntry ) {
132 mEntry->flushEntry(); 132 mEntry->flushEntry();
133 mEntry = jEntries.next(); 133 mEntry = jEntries.next();
134 } 134 }
135 ff = false; 135 ff = false;
136} 136}
137 137
138void KOJournalView::clearList() 138void KOJournalView::clearList()
139{ 139{
140 JournalEntry* mEntry = jEntries.first(); 140 JournalEntry* mEntry = jEntries.first();
141 while ( mEntry ) { 141 while ( mEntry ) {
142 mEntry->clear(); 142 mEntry->clear();
143 mEntry = jEntries.next(); 143 mEntry = jEntries.next();
144 } 144 }
145} 145}
146void KOJournalView::newJournal() 146void KOJournalView::newJournal()
147{ 147{
148 //qDebug(" KOJournalView::newJournal()"); 148 //qDebug(" KOJournalView::newJournal()");
149 flushView(); 149 flushView();
150 Journal* mJournal = new Journal; 150 Journal* mJournal = new Journal;
151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
152 mCalendar->addJournal(mJournal); 152 mCalendar->addJournal(mJournal);
153 showDates( mDate, QDate() ); 153 showDates( mDate, QDate() );
154} 154}
155 155
156void KOJournalView::showOnly ( Journal* j ) 156void KOJournalView::showOnly ( Journal* j )
157{ 157{
158 qDebug("showOnly %x ", j); 158 //qDebug("showOnly %x ", j);
159 flushView(); 159 flushView();
160 if ( j == 0 ) { 160 if ( j == 0 ) {
161 showDates( mDate, QDate() ); 161 showDates( mDate, QDate() );
162 return; 162 return;
163 } 163 }
164 QPtrList<Journal> jl; 164 QPtrList<Journal> jl;
165 jl.append ( j ); 165 jl.append ( j );
166 showList( jl ); 166 showList( jl );
167 JournalEntry* mEntry = jEntries.first(); 167 JournalEntry* mEntry = jEntries.first();
168 mEntry->setShowOnly(); 168 mEntry->setShowOnly();
169} 169}
170void KOJournalView::showList(QPtrList<Journal> jl) 170void KOJournalView::showList(QPtrList<Journal> jl)
171{ 171{
172 qDebug("KOJournalView::showList %d",jl.count() ); 172 //qDebug("KOJournalView::showList %d",jl.count() );
173 JournalEntry* mEntry = jEntries.first(); 173 JournalEntry* mEntry = jEntries.first();
174 JournalEntry* firstEntry = mEntry; 174 JournalEntry* firstEntry = mEntry;
175 int count = jl.count(); 175 int count = jl.count();
176 int iii = 0; 176 int iii = 0;
177 while ( iii < count ) { 177 while ( iii < count ) {
178 if ( !mEntry ) { 178 if ( !mEntry ) {
179 mEntry = getNewEntry(); 179 mEntry = getNewEntry();
180 mEntry->setVisibleMode( true );
180 mEntry->setDate(mDate); 181 mEntry->setDate(mDate);
181 mEntry->setJournal(jl.at(iii)); 182 mEntry->setJournal(jl.at(iii), false);
182 mEntry->setVisibleMode( true ); 183 mEntry->setVisibleMode( true );
183 mEntry->show(); 184 mEntry->show();
184 mEntry = 0; 185 mEntry = 0;
185 } else { 186 } else {
187 mEntry->setVisibleMode( true );
186 mEntry->setDate(mDate); 188 mEntry->setDate(mDate);
187 mEntry->setJournal(jl.at(iii)); 189 mEntry->setJournal(jl.at(iii), false);
188 mEntry->setVisibleMode( true ); 190 mEntry->setVisibleMode( true );
189 mEntry->show(); 191 mEntry->show();
190 mEntry = jEntries.next(); 192 mEntry = jEntries.next();
191 } 193 }
192 ++iii; 194 ++iii;
193 } 195 }
194 while ( mEntry ) { 196 while ( mEntry ) {
195 mEntry->setDate(mDate); 197 mEntry->setDate(mDate);
196 mEntry->clear(); 198 mEntry->clear();
197 if ( mEntry != firstEntry ) { 199 if ( mEntry != firstEntry ) {
198 mEntry->hide(); 200 mEntry->hide();
199 mEntry->setVisibleMode( false ); 201 mEntry->setVisibleMode( false );
200 } 202 }
201 else { 203 else {
202 mEntry->setVisibleMode( true ); 204 mEntry->setVisibleMode( true );
203 mEntry->show(); 205 mEntry->show();
204 } 206 }
205 mEntry = jEntries.next(); 207 mEntry = jEntries.next();
206 } 208 }
207} 209}
208 210
209void KOJournalView::showDates(const QDate &start, const QDate &) 211void KOJournalView::showDates(const QDate &start, const QDate &)
210{ 212{
211 mDate = start; 213 mDate = start;
212 mDateLabel->setText(KGlobal::locale()->formatDate(mDate)); 214 mDateLabel->setText(KGlobal::locale()->formatDate(mDate));
213 QPtrList<Journal> jl = calendar()->journals4Date( start ); 215 QPtrList<Journal> jl = calendar()->journals4Date( start );
214 showList( jl ); 216 showList( jl );
215} 217}
216 218
217void KOJournalView::showEvents(QPtrList<Event>) 219void KOJournalView::showEvents(QPtrList<Event>)
218{ 220{
219 // After new creation of list view no events are selected. 221 // After new creation of list view no events are selected.
220// emit incidenceSelected( 0 ); 222// emit incidenceSelected( 0 );
221} 223}
222 224
223void KOJournalView::changeEventDisplay(Event *, int /*action*/) 225void KOJournalView::changeEventDisplay(Event *, int /*action*/)
224{ 226{
225 updateView(); 227 updateView();
226} 228}
227 229
228void KOJournalView::keyPressEvent ( QKeyEvent * e ) 230void KOJournalView::keyPressEvent ( QKeyEvent * e )
229{ 231{
230 //qDebug("keyPressEven "); 232 //qDebug("keyPressEven ");
231 if ( e->state() == Qt::ControlButton ) { 233 if ( e->state() == Qt::ControlButton ) {
232 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 234 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
233 e->ignore(); 235 e->ignore();
234 } 236 }
235} 237}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index bb3d720..a886735 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -248,358 +248,368 @@ KOPrefs::KOPrefs() :
248 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 248 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
249 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 249 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
250 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 250 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
251 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 251 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
252 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 252 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
253 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 253 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
254 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 254 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
255 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 255 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
256 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 256 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
257 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 257 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
258 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 258 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
259 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 259 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
260 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 260 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
261 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 261 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
262 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 262 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
263 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 263 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
264 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 264 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
265 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 265 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
266 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 266 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
267 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 267 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
268#ifdef DESKTOP_VERSION 268#ifdef DESKTOP_VERSION
269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
270#else 270#else
271 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 271 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
272#endif 272#endif
273 addItemInt("Day Begins",&mDayBegins,7); 273 addItemInt("Day Begins",&mDayBegins,7);
274 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 274 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
275 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 275 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
276 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 276 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
277 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 277 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
278 278
279 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 279 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
280 addItemBool("Full View Month",&mFullViewMonth,true); 280 addItemBool("Full View Month",&mFullViewMonth,true);
281 addItemBool("Full View Todo",&mFullViewTodo,true); 281 addItemBool("Full View Todo",&mFullViewTodo,true);
282 addItemBool("Quick Todo",&mEnableQuickTodo,false); 282 addItemBool("Quick Todo",&mEnableQuickTodo,false);
283 283
284 addItemInt("Next X Days",&mNextXDays,3); 284 addItemInt("Next X Days",&mNextXDays,3);
285 285
286 KPrefs::setCurrentGroup("Printer"); 286 KPrefs::setCurrentGroup("Printer");
287 287
288 KPrefs::setCurrentGroup("Layout"); 288 KPrefs::setCurrentGroup("Layout");
289 289
290 addItemBool("CompactDialogs",&mCompactDialogs,false); 290 addItemBool("CompactDialogs",&mCompactDialogs,false);
291 addItemBool("VerticalScreen",&mVerticalScreen,true); 291 addItemBool("VerticalScreen",&mVerticalScreen,true);
292 292
293 KPrefs::setCurrentGroup("KOrganizer Plugins"); 293 KPrefs::setCurrentGroup("KOrganizer Plugins");
294 294
295 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 295 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
296 296
297 KPrefs::setCurrentGroup("Group Scheduling"); 297 KPrefs::setCurrentGroup("Group Scheduling");
298 298
299 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 299 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
300 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 300 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
301 addItemStringList("AdditionalMails",&mAdditionalMails,""); 301 addItemStringList("AdditionalMails",&mAdditionalMails,"");
302 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 302 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
303 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 303 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
304 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 304 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
305 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 305 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
306 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 306 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
307 307
308 KPrefs::setCurrentGroup( "Editors" ); 308 KPrefs::setCurrentGroup( "Editors" );
309 309
310 addItemStringList( "EventTemplates", &mEventTemplates ); 310 addItemStringList( "EventTemplates", &mEventTemplates );
311 addItemStringList( "TodoTemplates", &mTodoTemplates ); 311 addItemStringList( "TodoTemplates", &mTodoTemplates );
312 312
313 addItemInt("DestinationPolicy",&mDestination,standardDestination); 313 addItemInt("DestinationPolicy",&mDestination,standardDestination);
314 314
315 KPrefs::setCurrentGroup( "ViewOptions" ); 315 KPrefs::setCurrentGroup( "ViewOptions" );
316 addItemBool("EVshowDetails",&mEVshowDetails,true); 316 addItemBool("EVshowDetails",&mEVshowDetails,true);
317 addItemBool("EVshowCreated",&mEVshowCreated,true); 317 addItemBool("EVshowCreated",&mEVshowCreated,true);
318 addItemBool("EVshowChanged",&mEVshowChanged,true); 318 addItemBool("EVshowChanged",&mEVshowChanged,true);
319 addItemBool("WTshowDetails",&mWTshowDetails,false); 319 addItemBool("WTshowDetails",&mWTshowDetails,false);
320 addItemBool("WTshowCreated",&mWTshowCreated,false); 320 addItemBool("WTshowCreated",&mWTshowCreated,false);
321 addItemBool("WTshowChanged",&mWTshowChanged,false); 321 addItemBool("WTshowChanged",&mWTshowChanged,false);
322 mCalendars.setAutoDelete( true ); 322 mCalendars.setAutoDelete( true );
323} 323}
324 324
325 325
326KOPrefs::~KOPrefs() 326KOPrefs::~KOPrefs()
327{ 327{
328 if (mInstance == this) 328 if (mInstance == this)
329 mInstance = insd.setObject(0); 329 mInstance = insd.setObject(0);
330 mCalendars.setAutoDelete( true ); 330 mCalendars.setAutoDelete( true );
331 mCalendars.clear(); 331 mCalendars.clear();
332 //qDebug("KOPrefs::~KOPrefs() "); 332 //qDebug("KOPrefs::~KOPrefs() ");
333} 333}
334 334
335 335
336KOPrefs *KOPrefs::instance() 336KOPrefs *KOPrefs::instance()
337{ 337{
338 if (!mInstance) { 338 if (!mInstance) {
339 mInstance = insd.setObject(new KOPrefs()); 339 mInstance = insd.setObject(new KOPrefs());
340 mInstance->readConfig(); 340 mInstance->readConfig();
341 } 341 }
342 342
343 return mInstance; 343 return mInstance;
344} 344}
345 345
346void KOPrefs::usrSetDefaults() 346void KOPrefs::usrSetDefaults()
347{ 347{
348 348
349} 349}
350 350
351void KOPrefs::fillMailDefaults() 351void KOPrefs::fillMailDefaults()
352{ 352{
353 if (mName.isEmpty()) mName = i18n("Anonymous"); 353 if (mName.isEmpty()) mName = i18n("Anonymous");
354 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 354 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
355} 355}
356 356
357void KOPrefs::setTimeZoneIdDefault() 357void KOPrefs::setTimeZoneIdDefault()
358{ 358{
359 ; 359 ;
360} 360}
361 361
362void KOPrefs::setAllDefaults() 362void KOPrefs::setAllDefaults()
363{ 363{
364 setCategoryDefaults(); 364 setCategoryDefaults();
365 mEventSummaryUser = getDefaultList() ; 365 mEventSummaryUser = getDefaultList() ;
366 mTodoSummaryUser = getDefaultList() ; 366 mTodoSummaryUser = getDefaultList() ;
367 mJournalSummaryUser = getDefaultList() ; 367 mJournalSummaryUser = getDefaultList() ;
368 mLocationDefaults = getLocationDefaultList(); 368 mLocationDefaults = getLocationDefaultList();
369} 369}
370 370
371void KOPrefs::setCategoryDefaults() 371void KOPrefs::setCategoryDefaults()
372{ 372{
373 mCustomCategories.clear(); 373 mCustomCategories.clear();
374 mCustomCategories = getDefaultList(); 374 mCustomCategories = getDefaultList();
375 375
376 QStringList::Iterator it; 376 QStringList::Iterator it;
377 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 377 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
378 setCategoryColor(*it,mDefaultCategoryColor); 378 setCategoryColor(*it,mDefaultCategoryColor);
379 } 379 }
380} 380}
381QStringList KOPrefs::getLocationDefaultList() 381QStringList KOPrefs::getLocationDefaultList()
382{ 382{
383 QStringList retval ; 383 QStringList retval ;
384 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 384 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
385 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 385 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
386 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 386 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
387 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 387 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
388 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 388 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
389 389
390 retval.sort(); 390 retval.sort();
391 return retval; 391 return retval;
392} 392}
393QStringList KOPrefs::getDefaultList() 393QStringList KOPrefs::getDefaultList()
394{ 394{
395 QStringList retval ; 395 QStringList retval ;
396 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") 396 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer")
397 << i18n("Break") 397 << i18n("Break")
398 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") 398 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts")
399 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") 399 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts")
400 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") 400 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal")
401 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") 401 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping")
402 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") 402 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")
403 << i18n("Vacation") ; 403 << i18n("Vacation") ;
404 retval.sort(); 404 retval.sort();
405 //qDebug("cat %s ", retval.join("-").latin1()); 405 //qDebug("cat %s ", retval.join("-").latin1());
406 return retval; 406 return retval;
407} 407}
408// << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") 408// << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema")
409void KOPrefs::usrReadConfig() 409void KOPrefs::usrReadConfig()
410{ 410{
411 config()->setGroup("General"); 411 config()->setGroup("General");
412 412
413 //qDebug("KOPrefs::usrReadConfig() "); 413 //qDebug("KOPrefs::usrReadConfig() ");
414 mCustomCategories = config()->readListEntry("Custom Categories"); 414 mCustomCategories = config()->readListEntry("Custom Categories");
415 mOldLoadedLanguage = mOldLanguage ; 415 mOldLoadedLanguage = mOldLanguage ;
416 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 416 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
417 if (mLocationDefaults.isEmpty()) { 417 if (mLocationDefaults.isEmpty()) {
418 mLocationDefaults = getLocationDefaultList(); 418 mLocationDefaults = getLocationDefaultList();
419 } 419 }
420 420
421 if (mEventSummaryUser.isEmpty()) { 421 if (mEventSummaryUser.isEmpty()) {
422 mEventSummaryUser = getDefaultList() ; 422 mEventSummaryUser = getDefaultList() ;
423 } 423 }
424 if (mTodoSummaryUser.isEmpty()) { 424 if (mTodoSummaryUser.isEmpty()) {
425 mTodoSummaryUser = getDefaultList() ; 425 mTodoSummaryUser = getDefaultList() ;
426 } 426 }
427 427
428 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 428 if (mCustomCategories.isEmpty()) setCategoryDefaults();
429 429
430 config()->setGroup("Personal Settings"); 430 config()->setGroup("Personal Settings");
431 mName = config()->readEntry("user_name",""); 431 mName = config()->readEntry("user_name","");
432 mEmail = config()->readEntry("user_email",""); 432 mEmail = config()->readEntry("user_email","");
433 fillMailDefaults(); 433 fillMailDefaults();
434 434
435 config()->setGroup("Category Colors"); 435 config()->setGroup("Category Colors");
436 QStringList::Iterator it; 436 QStringList::Iterator it;
437 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 437 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
438 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 438 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
439 439
440 } 440 }
441 KConfig fc (locateLocal("config","kopicalendarrc")); 441 KConfig fc (locateLocal("config","kopicalendarrc"));
442 fc.setGroup("CC"); 442 fc.setGroup("CC");
443 int numCals = fc.readNumEntry("NumberCalendars",0 ); 443 int numCals = fc.readNumEntry("NumberCalendars",0 );
444 mNextAvailableCalendar = 1; 444 mNextAvailableCalendar = 1;
445 if ( numCals == 0 ) { 445 if ( numCals == 0 ) {
446 KopiCalendarFile *kkf = getNewCalendar(); 446 KopiCalendarFile *kkf = getNewCalendar();
447 kkf->isStandard = true; 447 kkf->isStandard = true;
448 kkf->mName = i18n("Standard"); 448 kkf->mName = i18n("Standard");
449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
450 } 450 }
451 while ( mNextAvailableCalendar <= numCals ) { 451 while ( mNextAvailableCalendar <= numCals ) {
452 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 452 //qDebug("Read cal #%d ", mNextAvailableCalendar );
453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
454 KopiCalendarFile *kkf = getNewCalendar(); 454 KopiCalendarFile *kkf = getNewCalendar();
455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
457 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 457 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
458 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 458 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
459 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 459 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
460 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 460 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
461 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 461 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
462 if ( kkf->mCalNumber == 1 ) { 462 if ( kkf->mCalNumber == 1 ) {
463 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 463 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
464 } 464 }
465 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 465 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
466 if ( kkf->mName == i18n("Birthdays") ) { 466 if ( kkf->mName == i18n("Birthdays") ) {
467 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 467 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
468 } 468 }
469 } 469 }
470 470
471 KPimPrefs::usrReadConfig(); 471 KPimPrefs::usrReadConfig();
472} 472}
473 473
474KopiCalendarFile * KOPrefs::getCalendar( int num ) 474KopiCalendarFile * KOPrefs::getCalendar( int num )
475{ 475{
476 return mDefCalColors[num-1]; 476 return mDefCalColors[num-1];
477} 477}
478 478
479KopiCalendarFile * KOPrefs::getNewCalendar() 479KopiCalendarFile * KOPrefs::getNewCalendar()
480{ 480{
481 KopiCalendarFile * kkf = new KopiCalendarFile(); 481 KopiCalendarFile * kkf = new KopiCalendarFile();
482 kkf->mCalNumber = mNextAvailableCalendar; 482 kkf->mCalNumber = mNextAvailableCalendar;
483 mDefCalColors.resize( mNextAvailableCalendar ); 483 mDefCalColors.resize( mNextAvailableCalendar );
484 mDefCalColors[mNextAvailableCalendar-1] = kkf; 484 mDefCalColors[mNextAvailableCalendar-1] = kkf;
485 ++mNextAvailableCalendar; 485 ++mNextAvailableCalendar;
486 kkf->mDefaultColor = mEventColor; 486 kkf->mDefaultColor = mEventColor;
487 kkf->mName = i18n("New Calendar"); 487 kkf->mName = i18n("New Calendar");
488 mCalendars.append( kkf ); 488 mCalendars.append( kkf );
489 return kkf; 489 return kkf;
490} 490}
491void KOPrefs::deleteCalendar( int num ) 491void KOPrefs::deleteCalendar( int num )
492{ 492{
493 KopiCalendarFile * kkf = mCalendars.first(); 493 KopiCalendarFile * kkf = mCalendars.first();
494 while ( kkf ) { 494 while ( kkf ) {
495 if ( kkf->mCalNumber == num ) { 495 if ( kkf->mCalNumber == num ) {
496 qDebug("KOPrefs::deleteCalendar %d ", num ); 496 qDebug("KOPrefs::deleteCalendar %d ", num );
497 mCalendars.remove( kkf ); 497 mCalendars.remove( kkf );
498 delete kkf; 498 delete kkf;
499 return; 499 return;
500 } 500 }
501 kkf = mCalendars.next(); 501 kkf = mCalendars.next();
502 } 502 }
503} 503}
504int KOPrefs::getCalendarID( const QString & name )
505{
506 KopiCalendarFile * kkf = mCalendars.first();
507 while ( kkf ) {
508 if ( name == kkf->mName)
509 return kkf->mCalNumber;
510 kkf = mCalendars.next();
511 }
512 return 1;
513}
504QString KOPrefs::calName( int calNum) const 514QString KOPrefs::calName( int calNum) const
505{ 515{
506 return (mDefCalColors[calNum-1])->mName; 516 return (mDefCalColors[calNum-1])->mName;
507} 517}
508QColor KOPrefs::defaultColor( int calNum ) const 518QColor KOPrefs::defaultColor( int calNum ) const
509{ 519{
510 if ( calNum == 1 ) return mEventColor; 520 if ( calNum == 1 ) return mEventColor;
511 return (mDefCalColors[calNum-1])->mDefaultColor; 521 return (mDefCalColors[calNum-1])->mDefaultColor;
512} 522}
513void KOPrefs::usrWriteConfig() 523void KOPrefs::usrWriteConfig()
514{ 524{
515 config()->setGroup("General"); 525 config()->setGroup("General");
516 config()->writeEntry("Custom Categories",mCustomCategories); 526 config()->writeEntry("Custom Categories",mCustomCategories);
517 527
518 config()->setGroup("Personal Settings"); 528 config()->setGroup("Personal Settings");
519 config()->writeEntry("user_name",mName); 529 config()->writeEntry("user_name",mName);
520 config()->writeEntry("user_email",mEmail); 530 config()->writeEntry("user_email",mEmail);
521 531
522 config()->setGroup("Category Colors"); 532 config()->setGroup("Category Colors");
523 QDictIterator<QColor> it(mCategoryColors); 533 QDictIterator<QColor> it(mCategoryColors);
524 while (it.current()) { 534 while (it.current()) {
525 config()->writeEntry(it.currentKey(),*(it.current())); 535 config()->writeEntry(it.currentKey(),*(it.current()));
526 ++it; 536 ++it;
527 } 537 }
528 KConfig fc (locateLocal("config","kopicalendarrc")); 538 KConfig fc (locateLocal("config","kopicalendarrc"));
529 fc.setGroup("CC"); 539 fc.setGroup("CC");
530 fc.writeEntry("NumberCalendars",mCalendars.count()); 540 fc.writeEntry("NumberCalendars",mCalendars.count());
531 int numCal = 1; 541 int numCal = 1;
532 int writeCal = 0; 542 int writeCal = 0;
533 while ( numCal < mNextAvailableCalendar ) { 543 while ( numCal < mNextAvailableCalendar ) {
534 KopiCalendarFile * kkf = mCalendars.first(); 544 KopiCalendarFile * kkf = mCalendars.first();
535 while ( kkf ) { 545 while ( kkf ) {
536 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 546 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
537 if ( kkf->mCalNumber == numCal ) { 547 if ( kkf->mCalNumber == numCal ) {
538 ++writeCal; 548 ++writeCal;
539 //qDebug("Write calendar %d %d ", numCal , writeCal); 549 //qDebug("Write calendar %d %d ", numCal , writeCal);
540 QString prefix = "Cal_" + QString::number( writeCal ); 550 QString prefix = "Cal_" + QString::number( writeCal );
541 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 551 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
542 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 552 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
543 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 553 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
544 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 554 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
545 fc.writeEntry( prefix+"_Name", kkf->mName); 555 fc.writeEntry( prefix+"_Name", kkf->mName);
546 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 556 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
547 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 557 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
548 } 558 }
549 kkf = mCalendars.next(); 559 kkf = mCalendars.next();
550 } 560 }
551 ++numCal; 561 ++numCal;
552 } 562 }
553 fc.sync(); 563 fc.sync();
554 KPimPrefs::usrWriteConfig(); 564 KPimPrefs::usrWriteConfig();
555} 565}
556 566
557void KOPrefs::setCategoryColor(QString cat,const QColor & color) 567void KOPrefs::setCategoryColor(QString cat,const QColor & color)
558{ 568{
559 mCategoryColors.replace(cat,new QColor(color)); 569 mCategoryColors.replace(cat,new QColor(color));
560} 570}
561 571
562QColor *KOPrefs::categoryColor(QString cat) 572QColor *KOPrefs::categoryColor(QString cat)
563{ 573{
564 QColor *color = 0; 574 QColor *color = 0;
565 575
566 if (!cat.isEmpty()) color = mCategoryColors[cat]; 576 if (!cat.isEmpty()) color = mCategoryColors[cat];
567 577
568 if (color) return color; 578 if (color) return color;
569 else return &mDefaultCategoryColor; 579 else return &mDefaultCategoryColor;
570} 580}
571 581
572void KOPrefs::setFullName(const QString &name) 582void KOPrefs::setFullName(const QString &name)
573{ 583{
574 mName = name; 584 mName = name;
575} 585}
576 586
577void KOPrefs::setEmail(const QString &email) 587void KOPrefs::setEmail(const QString &email)
578{ 588{
579 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 589 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
580 mEmail = email; 590 mEmail = email;
581} 591}
582 592
583QString KOPrefs::fullName() 593QString KOPrefs::fullName()
584{ 594{
585 if (mEmailControlCenter) { 595 if (mEmailControlCenter) {
586 KEMailSettings settings; 596 KEMailSettings settings;
587 return settings.getSetting(KEMailSettings::RealName); 597 return settings.getSetting(KEMailSettings::RealName);
588 } else { 598 } else {
589 return mName; 599 return mName;
590 } 600 }
591} 601}
592 602
593QString KOPrefs::email() 603QString KOPrefs::email()
594{ 604{
595 if (mEmailControlCenter) { 605 if (mEmailControlCenter) {
596 KEMailSettings settings; 606 KEMailSettings settings;
597 return settings.getSetting(KEMailSettings::EmailAddress); 607 return settings.getSetting(KEMailSettings::EmailAddress);
598 } else { 608 } else {
599 return mEmail; 609 return mEmail;
600 } 610 }
601} 611}
602KConfig* KOPrefs::getConfig() 612KConfig* KOPrefs::getConfig()
603{ 613{
604 return config(); 614 return config();
605} 615}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 53d193b..7ec5327 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,357 +1,358 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,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#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qobject.h> 30#include <qobject.h>
31 31
32class KConfig; 32class KConfig;
33class QFont; 33class QFont;
34class QColor; 34class QColor;
35class QStringList; 35class QStringList;
36 36
37#define VIEW_WN_VIEW 1 37#define VIEW_WN_VIEW 1
38#define VIEW_NX_VIEW 2 38#define VIEW_NX_VIEW 2
39#define VIEW_J_VIEW 3 39#define VIEW_J_VIEW 3
40#define VIEW_A_VIEW 4 40#define VIEW_A_VIEW 4
41#define VIEW_ML_VIEW 5 41#define VIEW_ML_VIEW 5
42#define VIEW_M_VIEW 6 42#define VIEW_M_VIEW 6
43#define VIEW_L_VIEW 7 43#define VIEW_L_VIEW 7
44#define VIEW_T_VIEW 8 44#define VIEW_T_VIEW 8
45 45
46class KopiCalendarFile : public QObject 46class KopiCalendarFile : public QObject
47{ 47{
48 public: 48 public:
49 KopiCalendarFile( ) : QObject( ) 49 KopiCalendarFile( ) : QObject( )
50 { 50 {
51 isStandard = false; 51 isStandard = false;
52 isEnabled = true; 52 isEnabled = true;
53 isAlarmEnabled = true; 53 isAlarmEnabled = true;
54 isReadOnly = false; 54 isReadOnly = false;
55 mName = "Calendar"; 55 mName = "Calendar";
56 mFileName = QDir::homeDirPath() + "/icalfile.ics"; 56 mFileName = QDir::homeDirPath() + "/icalfile.ics";
57 mCalNumber = 0; 57 mCalNumber = 0;
58 mDefaultColor = Qt::red; 58 mDefaultColor = Qt::red;
59 mErrorOnLoad = false; 59 mErrorOnLoad = false;
60 } 60 }
61 bool isStandard; 61 bool isStandard;
62 bool isEnabled; 62 bool isEnabled;
63 bool isAlarmEnabled; 63 bool isAlarmEnabled;
64 bool isReadOnly; 64 bool isReadOnly;
65 bool mErrorOnLoad; 65 bool mErrorOnLoad;
66 QString mName; 66 QString mName;
67 QString mFileName; 67 QString mFileName;
68 int mCalNumber; 68 int mCalNumber;
69 QColor mDefaultColor; 69 QColor mDefaultColor;
70 QDateTime mLoadDt; 70 QDateTime mLoadDt;
71}; 71};
72class KOPrefs : public KPimPrefs 72class KOPrefs : public KPimPrefs
73{ 73{
74 public: 74 public:
75 enum { FormatVCalendar, FormatICalendar }; 75 enum { FormatVCalendar, FormatICalendar };
76 enum { MailClientKMail, MailClientSendmail }; 76 enum { MailClientKMail, MailClientSendmail };
77 enum { IMIPDummy, IMIPKMail }; 77 enum { IMIPDummy, IMIPKMail };
78 enum { IMIPOutbox, IMIPdirectsend }; 78 enum { IMIPOutbox, IMIPdirectsend };
79 enum { neverAuto, addressbookAuto, selectedAuto }; 79 enum { neverAuto, addressbookAuto, selectedAuto };
80 enum { standardDestination, askDestination }; 80 enum { standardDestination, askDestination };
81 81
82 virtual ~KOPrefs(); 82 virtual ~KOPrefs();
83 83
84 /** Get instance of KOPrefs. It is made sure that there is only one 84 /** Get instance of KOPrefs. It is made sure that there is only one
85 instance. */ 85 instance. */
86 static KOPrefs *instance(); 86 static KOPrefs *instance();
87 87
88 /** Set preferences to default values */ 88 /** Set preferences to default values */
89 void usrSetDefaults(); 89 void usrSetDefaults();
90 90
91 /** Read preferences from config file */ 91 /** Read preferences from config file */
92 void usrReadConfig(); 92 void usrReadConfig();
93 93
94 /** Write preferences to config file */ 94 /** Write preferences to config file */
95 void usrWriteConfig(); 95 void usrWriteConfig();
96 void setCategoryDefaults(); 96 void setCategoryDefaults();
97 void setAllDefaults(); 97 void setAllDefaults();
98 KopiCalendarFile * getNewCalendar(); 98 KopiCalendarFile * getNewCalendar();
99 KopiCalendarFile * getCalendar( int ); 99 KopiCalendarFile * getCalendar( int );
100 void deleteCalendar( int ); 100 void deleteCalendar( int );
101 QColor defaultColor( int ) const; 101 QColor defaultColor( int ) const;
102 QString calName( int ) const; 102 QString calName( int ) const;
103 int getCalendarID( const QString & name );
103 protected: 104 protected:
104 void setTimeZoneIdDefault(); 105 void setTimeZoneIdDefault();
105 106
106 /** Fill empty mail fields with default values. */ 107 /** Fill empty mail fields with default values. */
107 void fillMailDefaults(); 108 void fillMailDefaults();
108 109
109 private: 110 private:
110 /** Constructor disabled for public. Use instance() to create a KOPrefs 111 /** Constructor disabled for public. Use instance() to create a KOPrefs
111 object. */ 112 object. */
112 KOPrefs(); 113 KOPrefs();
113 114
114 static KOPrefs *mInstance; 115 static KOPrefs *mInstance;
115 QStringList getDefaultList(); 116 QStringList getDefaultList();
116 QStringList getLocationDefaultList(); 117 QStringList getLocationDefaultList();
117 public: 118 public:
118 // preferences data 119 // preferences data
119 KConfig* getConfig(); 120 KConfig* getConfig();
120 void setFullName(const QString &); 121 void setFullName(const QString &);
121 QString fullName(); 122 QString fullName();
122 void setEmail(const QString &); 123 void setEmail(const QString &);
123 QString email(); 124 QString email();
124 125
125 QString mAdditional; 126 QString mAdditional;
126 127
127 bool mEmailControlCenter; 128 bool mEmailControlCenter;
128 129
129 bool mBcc; 130 bool mBcc;
130 bool mAutoSave; 131 bool mAutoSave;
131 int mAutoSaveInterval; 132 int mAutoSaveInterval;
132 bool mConfirm; 133 bool mConfirm;
133 134
134 bool mEnableGroupScheduling; 135 bool mEnableGroupScheduling;
135 bool mEnableProjectView; 136 bool mEnableProjectView;
136 137
137 int mDefaultFormat; 138 int mDefaultFormat;
138 int mMailClient; 139 int mMailClient;
139 140
140 int mStartTime; 141 int mStartTime;
141 int mDefaultDuration; 142 int mDefaultDuration;
142 int mAlarmTime; 143 int mAlarmTime;
143 144
144 int mWorkingHoursStart; 145 int mWorkingHoursStart;
145 int mWorkingHoursEnd; 146 int mWorkingHoursEnd;
146 bool mExcludeHolidays; 147 bool mExcludeHolidays;
147 bool mExcludeSaturdays; 148 bool mExcludeSaturdays;
148 bool mMarcusBainsShowSeconds; 149 bool mMarcusBainsShowSeconds;
149 150
150 QFont mTimeBarFont; 151 QFont mTimeBarFont;
151 QFont mMonthViewFont; 152 QFont mMonthViewFont;
152 QFont mAgendaViewFont; 153 QFont mAgendaViewFont;
153 QFont mMarcusBainsFont; 154 QFont mMarcusBainsFont;
154 QFont mTimeLabelsFont; 155 QFont mTimeLabelsFont;
155 QFont mTodoViewFont; 156 QFont mTodoViewFont;
156 QFont mListViewFont; 157 QFont mListViewFont;
157 QFont mDateNavigatorFont; 158 QFont mDateNavigatorFont;
158 QFont mEditBoxFont; 159 QFont mEditBoxFont;
159 QFont mJornalViewFont; 160 QFont mJornalViewFont;
160 QFont mWhatsNextFont; 161 QFont mWhatsNextFont;
161 QFont mEventViewFont; 162 QFont mEventViewFont;
162 163
163 164
164 165
165 166
166 QColor mHolidayColor; 167 QColor mHolidayColor;
167 QColor mHighlightColor; 168 QColor mHighlightColor;
168 QColor mEventColor; 169 QColor mEventColor;
169 QColor mTodoDoneColor; 170 QColor mTodoDoneColor;
170 QColor mAgendaBgColor; 171 QColor mAgendaBgColor;
171 QColor mWorkingHoursColor; 172 QColor mWorkingHoursColor;
172 QColor mTodoDueTodayColor; 173 QColor mTodoDueTodayColor;
173 QColor mTodoOverdueColor; 174 QColor mTodoOverdueColor;
174 QColor mTodoRunColor; 175 QColor mTodoRunColor;
175 QColor mMonthViewEvenColor; 176 QColor mMonthViewEvenColor;
176 QColor mMonthViewOddColor; 177 QColor mMonthViewOddColor;
177 QColor mMonthViewHolidayColor; 178 QColor mMonthViewHolidayColor;
178 bool mMonthViewUsesDayColors; 179 bool mMonthViewUsesDayColors;
179 bool mMonthViewSatSunTog; 180 bool mMonthViewSatSunTog;
180 bool mMonthViewWeek; 181 bool mMonthViewWeek;
181 QColor mAppColor1; 182 QColor mAppColor1;
182 QColor mAppColor2; 183 QColor mAppColor2;
183 bool mUseAppColors; 184 bool mUseAppColors;
184 185
185 int mDayBegins; 186 int mDayBegins;
186 int mHourSize; 187 int mHourSize;
187 int mAllDaySize; 188 int mAllDaySize;
188 bool mShowFullMenu; 189 bool mShowFullMenu;
189 bool mDailyRecur; 190 bool mDailyRecur;
190 bool mWeeklyRecur; 191 bool mWeeklyRecur;
191 bool mMonthDailyRecur; 192 bool mMonthDailyRecur;
192 bool mMonthWeeklyRecur; 193 bool mMonthWeeklyRecur;
193 bool mMonthShowIcons; 194 bool mMonthShowIcons;
194 bool mMonthShowTimes; 195 bool mMonthShowTimes;
195 bool mMonthShowShort; 196 bool mMonthShowShort;
196 bool mEnableToolTips; 197 bool mEnableToolTips;
197 bool mEnableMonthScroll; 198 bool mEnableMonthScroll;
198 bool mFullViewMonth; 199 bool mFullViewMonth;
199 bool mMonthViewUsesCategoryColor; 200 bool mMonthViewUsesCategoryColor;
200 bool mFullViewTodo; 201 bool mFullViewTodo;
201 bool mShowCompletedTodo; 202 bool mShowCompletedTodo;
202 bool mMarcusBainsEnabled; 203 bool mMarcusBainsEnabled;
203 int mNextXDays; 204 int mNextXDays;
204 int mWhatsNextDays; 205 int mWhatsNextDays;
205 int mWhatsNextPrios; 206 int mWhatsNextPrios;
206 bool mEnableQuickTodo; 207 bool mEnableQuickTodo;
207 208
208 bool mCompactDialogs; 209 bool mCompactDialogs;
209 bool mVerticalScreen; 210 bool mVerticalScreen;
210 211
211 bool mShowIconNewTodo; 212 bool mShowIconNewTodo;
212 bool mShowIconNewEvent; 213 bool mShowIconNewEvent;
213 bool mShowIconSearch; 214 bool mShowIconSearch;
214 bool mShowIconList; 215 bool mShowIconList;
215 bool mShowIconDay1; 216 bool mShowIconDay1;
216 bool mShowIconDay5; 217 bool mShowIconDay5;
217 bool mShowIconDay6; 218 bool mShowIconDay6;
218 bool mShowIconDay7; 219 bool mShowIconDay7;
219 bool mShowIconMonth; 220 bool mShowIconMonth;
220 bool mShowIconTodoview; 221 bool mShowIconTodoview;
221 bool mShowIconBackFast; 222 bool mShowIconBackFast;
222 bool mShowIconBack; 223 bool mShowIconBack;
223 bool mShowIconToday; 224 bool mShowIconToday;
224 bool mShowIconForward; 225 bool mShowIconForward;
225 bool mShowIconForwardFast; 226 bool mShowIconForwardFast;
226 bool mShowIconWhatsThis; 227 bool mShowIconWhatsThis;
227 bool mShowIconWeekNum; 228 bool mShowIconWeekNum;
228 bool mShowIconNextDays; 229 bool mShowIconNextDays;
229 bool mShowIconNext; 230 bool mShowIconNext;
230 bool mShowIconJournal; 231 bool mShowIconJournal;
231 bool mShowIconFilter; 232 bool mShowIconFilter;
232 bool mShowIconOnetoolbar; 233 bool mShowIconOnetoolbar;
233 bool mShowIconNavigator; 234 bool mShowIconNavigator;
234 bool mShowIconAllday; 235 bool mShowIconAllday;
235 bool mShowIconFilterview; 236 bool mShowIconFilterview;
236 bool mShowIconToggleFull; 237 bool mShowIconToggleFull;
237 238
238 bool mShowIconStretch; 239 bool mShowIconStretch;
239 240
240 bool mToolBarHor; 241 bool mToolBarHor;
241 bool mToolBarUp; 242 bool mToolBarUp;
242 bool mToolBarHorV; 243 bool mToolBarHorV;
243 bool mToolBarUpV; 244 bool mToolBarUpV;
244 bool mToolBarHorN; 245 bool mToolBarHorN;
245 bool mToolBarUpN; 246 bool mToolBarUpN;
246 bool mToolBarHorF; 247 bool mToolBarHorF;
247 bool mToolBarUpF; 248 bool mToolBarUpF;
248 bool mToolBarMiniIcons; 249 bool mToolBarMiniIcons;
249 250
250 bool mAskForQuit; 251 bool mAskForQuit;
251 bool mUsePassWd; 252 bool mUsePassWd;
252 bool mShowSyncEvents; 253 bool mShowSyncEvents;
253 bool mShowTodoInAgenda; 254 bool mShowTodoInAgenda;
254 bool mShowCompletedTodoInAgenda; 255 bool mShowCompletedTodoInAgenda;
255 bool mShowTimeInAgenda; 256 bool mShowTimeInAgenda;
256 bool mHideNonStartedTodos; 257 bool mHideNonStartedTodos;
257 258
258 bool mBlockPopupMenu; 259 bool mBlockPopupMenu;
259 260
260 int mLastSyncTime; 261 int mLastSyncTime;
261 void setCategoryColor(QString cat,const QColor & color); 262 void setCategoryColor(QString cat,const QColor & color);
262 QColor *categoryColor(QString cat); 263 QColor *categoryColor(QString cat);
263 264
264 QString mArchiveFile; 265 QString mArchiveFile;
265 QString mHtmlExportFile; 266 QString mHtmlExportFile;
266 bool mHtmlWithSave; 267 bool mHtmlWithSave;
267 268
268 QStringList mSelectedPlugins; 269 QStringList mSelectedPlugins;
269 270
270 QString mLastImportFile; 271 QString mLastImportFile;
271 QString mLastVcalFile; 272 QString mLastVcalFile;
272 QString mLastSaveFile; 273 QString mLastSaveFile;
273 QString mLastLoadFile; 274 QString mLastLoadFile;
274 275
275 276
276 QString mDefaultAlarmFile; 277 QString mDefaultAlarmFile;
277 int mIMIPScheduler; 278 int mIMIPScheduler;
278 int mIMIPSend; 279 int mIMIPSend;
279 QStringList mAdditionalMails; 280 QStringList mAdditionalMails;
280 int mIMIPAutoRefresh; 281 int mIMIPAutoRefresh;
281 int mIMIPAutoInsertReply; 282 int mIMIPAutoInsertReply;
282 int mIMIPAutoInsertRequest; 283 int mIMIPAutoInsertRequest;
283 int mIMIPAutoFreeBusy; 284 int mIMIPAutoFreeBusy;
284 int mIMIPAutoFreeBusyReply; 285 int mIMIPAutoFreeBusyReply;
285 286
286 QStringList mTodoTemplates; 287 QStringList mTodoTemplates;
287 QStringList mEventTemplates; 288 QStringList mEventTemplates;
288 289
289 int mDestination; 290 int mDestination;
290 291
291 292
292 bool mEditOnDoubleClick; 293 bool mEditOnDoubleClick;
293 bool mViewChangeHoldFullscreen; 294 bool mViewChangeHoldFullscreen;
294 bool mViewChangeHoldNonFullscreen; 295 bool mViewChangeHoldNonFullscreen;
295 bool mCenterOnCurrentTime; 296 bool mCenterOnCurrentTime;
296 bool mSetTimeToDayStartAt; 297 bool mSetTimeToDayStartAt;
297 bool mHighlightCurrentDay; 298 bool mHighlightCurrentDay;
298 bool mUseHighlightLightColor; 299 bool mUseHighlightLightColor;
299 bool mListViewMonthTimespan; 300 bool mListViewMonthTimespan;
300 bool mWNViewShowsParents; 301 bool mWNViewShowsParents;
301 bool mWNViewShowsPast; 302 bool mWNViewShowsPast;
302 bool mWNViewShowLocation; 303 bool mWNViewShowLocation;
303 bool mTodoViewShowsPercentage; 304 bool mTodoViewShowsPercentage;
304 bool mTodoViewUsesCatColors; 305 bool mTodoViewUsesCatColors;
305 bool mMonthViewUsesBigFont; 306 bool mMonthViewUsesBigFont;
306 bool mTodoViewUsesSmallFont; 307 bool mTodoViewUsesSmallFont;
307 bool mTodoViewUsesForegroundColor; 308 bool mTodoViewUsesForegroundColor;
308 bool mMonthViewUsesForegroundColor; 309 bool mMonthViewUsesForegroundColor;
309 310
310 bool mHightlightDateTimeEdit; 311 bool mHightlightDateTimeEdit;
311 bool mShortDateInViewer; 312 bool mShortDateInViewer;
312 313
313 bool mShowDateNavigator; 314 bool mShowDateNavigator;
314 315
315 QStringList mLocationDefaults; 316 QStringList mLocationDefaults;
316 QStringList mEventSummaryUser; 317 QStringList mEventSummaryUser;
317 QStringList mTodoSummaryUser; 318 QStringList mTodoSummaryUser;
318 QStringList mJournalSummaryUser; 319 QStringList mJournalSummaryUser;
319 320
320 bool mUseInternalAlarmNotification; 321 bool mUseInternalAlarmNotification;
321 int mAlarmPlayBeeps; 322 int mAlarmPlayBeeps;
322 int mAlarmSuspendTime; 323 int mAlarmSuspendTime;
323 int mAlarmSuspendCount; 324 int mAlarmSuspendCount;
324 int mAlarmBeepInterval; 325 int mAlarmBeepInterval;
325 int mOldLanguage; 326 int mOldLanguage;
326 int mOldLoadedLanguage; 327 int mOldLoadedLanguage;
327 328
328 329
329 QString mActiveSyncPort; 330 QString mActiveSyncPort;
330 QString mActiveSyncIP; 331 QString mActiveSyncIP;
331 332
332 // settings for eventviewer 333 // settings for eventviewer
333 bool mEVshowDetails; 334 bool mEVshowDetails;
334 bool mEVshowCreated; 335 bool mEVshowCreated;
335 bool mEVshowChanged; 336 bool mEVshowChanged;
336 bool mWTshowDetails; 337 bool mWTshowDetails;
337 bool mWTshowCreated; 338 bool mWTshowCreated;
338 bool mWTshowChanged; 339 bool mWTshowChanged;
339 340
340 int mCurrentDisplayedView; 341 int mCurrentDisplayedView;
341 QPtrList<KopiCalendarFile> mCalendars; 342 QPtrList<KopiCalendarFile> mCalendars;
342 int mNextAvailableCalendar; 343 int mNextAvailableCalendar;
343 344
344 private: 345 private:
345 QDict<QColor> mCategoryColors; 346 QDict<QColor> mCategoryColors;
346 QArray<KopiCalendarFile*> mDefCalColors; 347 QArray<KopiCalendarFile*> mDefCalColors;
347 QColor mDefaultCategoryColor; 348 QColor mDefaultCategoryColor;
348 349
349 QFont mDefaultTimeBarFont; 350 QFont mDefaultTimeBarFont;
350 QFont mDefaultViewFont; 351 QFont mDefaultViewFont;
351 QFont mDefaultMonthViewFont; 352 QFont mDefaultMonthViewFont;
352 353
353 QString mName; 354 QString mName;
354 QString mEmail; 355 QString mEmail;
355}; 356};
356 357
357#endif 358#endif