summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp36
-rw-r--r--korganizer/journalentry.h3
-rw-r--r--korganizer/koeditorgeneral.cpp4
-rw-r--r--korganizer/kojournalview.cpp36
-rw-r--r--korganizer/kolocationbox.cpp8
-rw-r--r--korganizer/kolocationbox.h2
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koprefs.h1
8 files changed, 56 insertions, 36 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 3c38f34..4751d40 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,289 +1,299 @@
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>
47#include "kolocationbox.h"
46 48
47#include <libkcal/journal.h> 49#include <libkcal/journal.h>
48#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 51#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 52#include <kresources/resourceselectdialog.h>
51 53
52#include "journalentry.h" 54#include "journalentry.h"
53//#include "journalentry.moc" 55//#include "journalentry.moc"
54#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
56#endif 58#endif
57JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 59JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
58 QFrame(parent) 60 QFrame(parent)
59{ 61{
60 62
61 int fac = 5; 63 int fac = 5;
62 heiHint = QApplication::desktop()->height(); 64 heiHint = QApplication::desktop()->height();
63 if ( heiHint > 800 ) 65 if ( heiHint > 800 )
64 fac += 2; 66 fac += 2;
65 heiHint = heiHint / fac; 67 heiHint = heiHint / fac;
66 68
67 showOnlyMode = false; 69 showOnlyMode = false;
68 mCalendar = calendar; 70 mCalendar = calendar;
69 mJournal = 0; 71 mJournal = 0;
70 visibleMode = true; 72 visibleMode = true;
71 QHBox * vb = new QHBox ( this ); 73 QHBox * vb = new QHBox ( this );
72 QPixmap iconp; 74 QPixmap iconp;
73 75 vb->setMargin ( KDialog::marginHint()-1 );
74 QPushButton * toggleJournal = new QPushButton( vb ); 76 QPushButton * toggleJournal = new QPushButton( vb );
75 iconp = SmallIcon("1updownarrow"); 77 iconp = SmallIcon("1updownarrow");
76 toggleJournal->setPixmap (iconp ) ; 78 toggleJournal->setPixmap (iconp ) ;
77 new QLabel(" "+i18n("Title: "),vb); 79 new QLabel(" "+i18n("Title: "),vb);
78 mTitle = new KLineEdit ( vb ); 80 mTitle = new KOLocationBox(TRUE, vb, 30);
81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) );
79 mTitleLabel = new QLabel(i18n("Title"),vb); 82 mTitleLabel = new QLabel(i18n("Title"),vb);
80 mTitleLabel->setMargin(0); 83 mTitleLabel->setMargin(0);
81 mTitleLabel->setAlignment(AlignCenter); 84 mTitleLabel->setAlignment(AlignCenter);
82 QPushButton * loadTemplate = new QPushButton( vb ); 85 QPushButton * loadTemplate = new QPushButton( vb );
83 QPushButton * saveTemplate = new QPushButton( vb ); 86 QPushButton * saveTemplate = new QPushButton( vb );
84 if ( QApplication::desktop()->width() < 321 ) 87 if ( QApplication::desktop()->width() < 321 )
85 iconp = SmallIcon("fileexport16"); 88 iconp = SmallIcon("fileexport16");
86 else 89 else
87 iconp = SmallIcon("fileexport"); 90 iconp = SmallIcon("fileexport");
88 saveTemplate->setPixmap (iconp ) ; 91 saveTemplate->setPixmap (iconp ) ;
89 int size = saveTemplate->sizeHint().height(); 92 int size = saveTemplate->sizeHint().height();
90 if ( QApplication::desktop()->width() < 321 ) 93 if ( QApplication::desktop()->width() < 321 )
91 iconp = SmallIcon("fileimport16"); 94 iconp = SmallIcon("fileimport16");
92 else 95 else
93 iconp = SmallIcon("fileimport"); 96 iconp = SmallIcon("fileimport");
94 loadTemplate->setPixmap (iconp ) ; 97 loadTemplate->setPixmap (iconp ) ;
95 loadTemplate->setFixedSize( size, size ); 98 loadTemplate->setFixedSize( size, size );
96 saveTemplate->setFixedSize( size, size ); 99 saveTemplate->setFixedSize( size, size );
97 toggleJournal->setFixedSize( size , size ); 100 toggleJournal->setFixedSize( size , size );
101 mTitle->setMaximumHeight( size+4);
98 mEditor = new KTextEdit(this); 102 mEditor = new KTextEdit(this);
99#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
100 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 104 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
101#endif 105#endif
102 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 106 mEditor->setWordWrap( KTextEdit::WidgetWidth );
103 QBoxLayout *topLayout = new QVBoxLayout(this); 107 QBoxLayout *topLayout = new QVBoxLayout(this);
104 topLayout->addWidget(vb); 108 topLayout->addWidget(vb);
105 topLayout->addWidget(mEditor); 109 topLayout->addWidget(mEditor);
106 mEditor->installEventFilter(this); 110 mEditor->installEventFilter(this);
107 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 111 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
108 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 112 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
109 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 113 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
114 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
115 mTitle->lineEdit ()->setText("");
110} 116}
111 117
112JournalEntry::~JournalEntry() 118JournalEntry::~JournalEntry()
113{ 119{
114 //qDebug("JournalEntry::~JournalEntry() "); 120 //qDebug("JournalEntry::~JournalEntry() ");
115} 121}
116QSize JournalEntry::sizeHint() const 122QSize JournalEntry::sizeHint() const
117{ 123{
118 return QSize ( 240, heiHint ); 124 return QSize ( 240, heiHint );
119} 125}
120void JournalEntry::slotSaveTemplate() 126void JournalEntry::slotSaveTemplate()
121{ 127{
122 QString fileName =locateLocal( "templates", "journals" ); 128 QString fileName =locateLocal( "templates", "journals" );
123 QDir t_dir; 129 QDir t_dir;
124 if ( !t_dir.exists(fileName) ) 130 if ( !t_dir.exists(fileName) )
125 t_dir.mkdir ( fileName ); 131 t_dir.mkdir ( fileName );
126 fileName += "/journal"; 132 fileName += "/journal";
127 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 133 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
128 if ( fileName.length() == 0 ) 134 if ( fileName.length() == 0 )
129 return; 135 return;
130 136
131 QFile fileIn( fileName ); 137 QFile fileIn( fileName );
132 if (!fileIn.open( IO_WriteOnly ) ) { 138 if (!fileIn.open( IO_WriteOnly ) ) {
133 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 139 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
134 .arg( fileName ) ); 140 .arg( fileName ) );
135 return; 141 return;
136 } 142 }
137 // QString text; 143 // QString text;
138 QTextStream tsIn( &fileIn ); 144 QTextStream tsIn( &fileIn );
139 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 145 tsIn.setCodec( QTextCodec::codecForName("utf8") );
140 tsIn << mEditor->text(); 146 tsIn << mEditor->text();
141 fileIn.close(); 147 fileIn.close();
142} 148}
143void JournalEntry::slotLoadTemplate() 149void JournalEntry::slotLoadTemplate()
144{ 150{
145 QString fileName =locateLocal( "templates", "journals" ); 151 QString fileName =locateLocal( "templates", "journals" );
146 QDir t_dir; 152 QDir t_dir;
147 if ( !t_dir.exists(fileName) ) 153 if ( !t_dir.exists(fileName) )
148 t_dir.mkdir ( fileName ); 154 t_dir.mkdir ( fileName );
149 fileName += "/journal"; 155 fileName += "/journal";
150 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 156 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
151 if ( fileName.length() == 0 ) 157 if ( fileName.length() == 0 )
152 return; 158 return;
153 QFile fileIn( fileName ); 159 QFile fileIn( fileName );
154 if (!fileIn.open( IO_ReadOnly ) ) { 160 if (!fileIn.open( IO_ReadOnly ) ) {
155 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 161 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
156 .arg( fileName ) ); 162 .arg( fileName ) );
157 return; 163 return;
158 } 164 }
159 QTextStream tsIn( &fileIn ); 165 QTextStream tsIn( &fileIn );
160 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 166 tsIn.setCodec( QTextCodec::codecForName("utf8") );
161 QString text = tsIn.read(); 167 QString text = tsIn.read();
162 fileIn.close(); 168 fileIn.close();
163 int line, col; 169 int line, col;
164 mEditor->getCursorPosition (& line, & col ); 170 mEditor->getCursorPosition (& line, & col );
165 mEditor-> insertAt ( text, line, col, true ); 171 mEditor-> insertAt ( text, line, col, true );
166 //mEditor->setIgnoreMark( true ); 172 //mEditor->setIgnoreMark( true );
167} 173}
168void JournalEntry::setDate(const QDate &date) 174void JournalEntry::setDate(const QDate &date)
169{ 175{
170 showOnlyMode = false; 176 showOnlyMode = false;
171 writeJournal(); 177 writeJournal();
172 mDate = date; 178 mDate = date;
173 int id = mCalendar->defaultCalendar(); 179 int id = mCalendar->defaultCalendar();
174 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 180 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
175 mTitleLabel->setText( " (" + calname +")"); 181 mTitleLabel->setText( " (" + calname +")");
176} 182}
177 183
178void JournalEntry::toggleShowJournal() 184void JournalEntry::toggleShowJournal()
179{ 185{
180 if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) 186 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty())
181 flushEntry(); 187 flushEntry();
182 if ( showOnlyMode ) 188 if ( showOnlyMode )
183 emit showJournalOnly( 0 ); 189 emit showJournalOnly( 0 );
184 else { 190 else {
185 // we have to protect mJournal from deleting if mJournal has empty text 191 // we have to protect mJournal from deleting if mJournal has empty text
186 visibleMode = false; // set to true via :setShowOnly() 192 visibleMode = false; // set to true via :setShowOnly()
187 emit showJournalOnly( mJournal ); 193 emit showJournalOnly( mJournal );
188 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); 194 //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) );
189 } 195 }
190} 196}
191void JournalEntry::setVisibleOn() 197void JournalEntry::setVisibleOn()
192{ 198{
193 visibleMode = true; 199 visibleMode = true;
194} 200}
195void JournalEntry::setShowOnly() 201void JournalEntry::setShowOnly()
196{ 202{
197 showOnlyMode = true; 203 showOnlyMode = true;
198 if ( mTitle->text().isEmpty() ) 204 if ( mTitle->currentText().isEmpty() )
199 mTitle->setFocus(); 205 mTitle->setFocus();
200 else 206 else
201 mEditor->setFocus(); 207 mEditor->setFocus();
202} 208}
203void JournalEntry::setJournal(Journal *journal) 209void JournalEntry::setJournal(Journal *journal)
204{ 210{
205 writeJournal(); 211 writeJournal();
212 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
206 213
207 mJournal = journal; 214 mJournal = journal;
208 if ( journal->isReadOnly() ) 215 if ( journal->isReadOnly() )
209 mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); 216 mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")");
210 else 217 else
211 mTitle->setText(mJournal->summary()); 218 mTitle->lineEdit ()->setText(mJournal->summary());
212 mEditor->setText(mJournal->description()); 219 mEditor->setText(mJournal->description());
213 mTitle->setReadOnly (journal->isReadOnly() ); 220 mTitle->setEnabled (!journal->isReadOnly() );
214 mEditor->setReadOnly ( journal->isReadOnly() ); 221 mEditor->setReadOnly ( journal->isReadOnly() );
215 int id = mJournal->calID(); 222 int id = mJournal->calID();
216 223
217 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 224 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
218 mTitleLabel->setText( " (" + calname +")"); 225 mTitleLabel->setText( " (" + calname +")");
219
220} 226}
221 227
222Journal *JournalEntry::journal() const 228Journal *JournalEntry::journal() const
223{ 229{
224 return mJournal; 230 return mJournal;
225} 231}
226 232
227 233
228void JournalEntry::clear() 234void JournalEntry::clear()
229{ 235{
230 mJournal = 0; 236 mJournal = 0;
231 mEditor->setText(""); 237 mEditor->setText("");
232 mTitle->setText(""); 238 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
239 mTitle->lineEdit ()->setText("");
233} 240}
234 241
235bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 242bool JournalEntry::eventFilter( QObject *o, QEvent *e )
236{ 243{
237// kdDebug() << "JournalEntry::event received " << e->type() << endl; 244// kdDebug() << "JournalEntry::event received " << e->type() << endl;
238 245
239 if ( e->type() == QEvent::FocusOut ) { 246 if ( e->type() == QEvent::FocusOut ) {
240 writeJournal(); 247 writeJournal();
241 } 248 }
242 if ( e->type() == QEvent::KeyPress ) { 249 if ( e->type() == QEvent::KeyPress ) {
243 QKeyEvent * k = (QKeyEvent *) e; 250 QKeyEvent * k = (QKeyEvent *) e;
244 if ( k->state() == Qt::ControlButton ) { 251 if ( k->state() == Qt::ControlButton ) {
245 k->ignore(); 252 k->ignore();
246 //return true; 253 //return true;
247 } 254 }
248 } 255 }
249 256
250 return QFrame::eventFilter( o, e ); // standard event processing 257 return QFrame::eventFilter( o, e ); // standard event processing
251} 258}
252 259
253void JournalEntry::writeJournal() 260void JournalEntry::writeJournal()
254{ 261{
255 if ( !visibleMode ) return; 262 if ( !visibleMode ) return;
256 if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { 263 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
257 if ( mJournal ) { 264 if ( mJournal ) {
258 Journal* j = mJournal; 265 Journal* j = mJournal;
259 mJournal = 0; 266 mJournal = 0;
260 bool conf = KOPrefs::instance()->mConfirm; 267 bool conf = KOPrefs::instance()->mConfirm;
261 KOPrefs::instance()->mConfirm = false; 268 KOPrefs::instance()->mConfirm = false;
262 emit deleteJournal(j); 269 emit deleteJournal(j);
263 KOPrefs::instance()->mConfirm = conf; 270 KOPrefs::instance()->mConfirm = conf;
264 } 271 }
265 return; 272 return;
266 } 273 }
267 274
268// kdDebug() << "JournalEntry::writeJournal()..." << endl; 275// kdDebug() << "JournalEntry::writeJournal()..." << endl;
269 276
270 if (!mJournal) { 277 if (!mJournal) {
271 mJournal = new Journal; 278 mJournal = new Journal;
272 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 279 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
273 mCalendar->addJournal(mJournal); 280 mCalendar->addJournal(mJournal);
274 } 281 }
275 if ( mJournal->description() != mEditor->text() ) 282 if ( mJournal->description() != mEditor->text() ) {
276 mJournal->setDescription(mEditor->text()); 283 mJournal->setDescription(mEditor->text());
277 if ( mJournal->summary() != mTitle->text() ) 284 }
278 mJournal->setSummary(mTitle->text()); 285 if ( mJournal->summary() != mTitle->currentText() ) {
286 mJournal->setSummary(mTitle->currentText());
287 mTitle->save(KOLocationBox::SUMMARYJOURNAL);
288 }
279} 289}
280 290
281void JournalEntry::flushEntry() 291void JournalEntry::flushEntry()
282{ 292{
283 writeJournal(); 293 writeJournal();
284} 294}
285void JournalEntry::keyPressEvent ( QKeyEvent * e ) 295void JournalEntry::keyPressEvent ( QKeyEvent * e )
286{ 296{
287 e->ignore(); 297 e->ignore();
288 298
289} 299}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index cc9b5ef..fb19fb1 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -1,84 +1,85 @@
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 KLineEdit; 34class KLineEdit;
35class KOLocationBox;
35 36
36using namespace KCal; 37using namespace KCal;
37 38
38class JournalEntry : public QFrame { 39class JournalEntry : public QFrame {
39 Q_OBJECT 40 Q_OBJECT
40 public: 41 public:
41 JournalEntry(Calendar *,QWidget *parent); 42 JournalEntry(Calendar *,QWidget *parent);
42 virtual ~JournalEntry(); 43 virtual ~JournalEntry();
43 44
44 void setJournal(Journal *); 45 void setJournal(Journal *);
45 Journal *journal() const; 46 Journal *journal() const;
46 47
47 void setDate(const QDate &); 48 void setDate(const QDate &);
48 49
49 void clear(); 50 void clear();
50 51
51 void flushEntry(); 52 void flushEntry();
52 void setShowOnly(); 53 void setShowOnly();
53 QSize sizeHint() const; 54 QSize sizeHint() const;
54 void setVisibleMode( bool b ) { visibleMode = b;} 55 void setVisibleMode( bool b ) { visibleMode = b;}
55 56
56 protected slots: 57 protected slots:
57 void slotSaveTemplate(); 58 void slotSaveTemplate();
58 void slotLoadTemplate(); 59 void slotLoadTemplate();
59 void toggleShowJournal(); 60 void toggleShowJournal();
60 void setVisibleOn(); 61 void setVisibleOn();
61 signals: 62 signals:
62 void deleteJournal(Journal *); 63 void deleteJournal(Journal *);
63 void newJournal(); 64 void newJournal();
64 void showJournalOnly( Journal * ); 65 void showJournalOnly( Journal * );
65 66
66 protected: 67 protected:
67 bool eventFilter( QObject *o, QEvent *e ); 68 bool eventFilter( QObject *o, QEvent *e );
68 69
69 void writeJournal(); 70 void writeJournal();
70 71
71 private: 72 private:
72 bool visibleMode; 73 bool visibleMode;
73 bool showOnlyMode; 74 bool showOnlyMode;
74 Calendar *mCalendar; 75 Calendar *mCalendar;
75 Journal *mJournal; 76 Journal *mJournal;
76 QDate mDate; 77 QDate mDate;
77 void keyPressEvent ( QKeyEvent * ) ; 78 void keyPressEvent ( QKeyEvent * ) ;
78 QLabel *mTitleLabel; 79 QLabel *mTitleLabel;
79 KLineEdit * mTitle; 80 KOLocationBox * mTitle;
80 KTextEdit *mEditor; 81 KTextEdit *mEditor;
81 int heiHint; 82 int heiHint;
82}; 83};
83 84
84#endif 85#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 407a5d5..fd50b05 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,624 +1,624 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h> 34#include <qregexp.h>
35 35
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kfiledialog.h> 43#include <kfiledialog.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45 45
46#include <libkcal/todo.h> 46#include <libkcal/todo.h>
47#include <libkcal/event.h> 47#include <libkcal/event.h>
48#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
49#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52#include "koglobals.h" 52#include "koglobals.h"
53 53
54#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
55#include "kolocationbox.h" 55#include "kolocationbox.h"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#else 58#else
59#include <qapplication.h> 59#include <qapplication.h>
60#endif 60#endif
61 61
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 63 QObject( parent, name)
64{ 64{
65 mNextFocus = 0; 65 mNextFocus = 0;
66} 66}
67 67
68KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
69{ 69{
70} 70}
71 71
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
73{ 73{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
75 75
76#if 0 76#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 79#endif
80 // 1 on pda 80 // 1 on pda
81 // 11 on desktop 81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 84 headerLayout->addWidget(summaryLabel,0,0);
85 85
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
91 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
92 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
95 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
96 if ( QApplication::desktop()->height() < 320 ) 96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(mSummaryEdit,0,1); 97 headerLayout->addWidget(mSummaryEdit,0,1);
98 else 98 else
99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); 99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
101 101
102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
103 if ( QApplication::desktop()->height() < 320 ) 103 if ( QApplication::desktop()->height() < 320 )
104 headerLayout->addWidget(locationLabel,0,2); 104 headerLayout->addWidget(locationLabel,0,2);
105 else 105 else
106 headerLayout->addWidget(locationLabel,1,0); 106 headerLayout->addWidget(locationLabel,1,0);
107 107
108 mLocationEdit = new KOLocationBox(TRUE,parent,10); 108 mLocationEdit = new KOLocationBox(TRUE,parent,30);
109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
111 mLocationEdit->setMaximumHeight( hei + 6); 111 mLocationEdit->setMaximumHeight( hei + 6);
112 112
113 // mLocationEdit = new QLineEdit(parent); 113 // mLocationEdit = new QLineEdit(parent);
114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
115 115
116 mCalendarBox = new QComboBox ( parent ); 116 mCalendarBox = new QComboBox ( parent );
117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
118 if ( QApplication::desktop()->height() < 320 ) { 118 if ( QApplication::desktop()->height() < 320 ) {
119 headerLayout->addWidget(mLocationEdit,0,3); 119 headerLayout->addWidget(mLocationEdit,0,3);
120 headerLayout->addWidget(mCalendarBox,0,4); 120 headerLayout->addWidget(mCalendarBox,0,4);
121 headerLayout->setColStretch( 1, 10); 121 headerLayout->setColStretch( 1, 10);
122 headerLayout->setColStretch( 3, 10); 122 headerLayout->setColStretch( 3, 10);
123 mCalendarBox->setMaximumWidth( 64 ); 123 mCalendarBox->setMaximumWidth( 64 );
124 } 124 }
125 else { 125 else {
126 headerLayout->addWidget(mLocationEdit,1,1); 126 headerLayout->addWidget(mLocationEdit,1,1);
127 headerLayout->addWidget(mCalendarBox,1,2); 127 headerLayout->addWidget(mCalendarBox,1,2);
128 headerLayout->setColStretch( 1, 3); 128 headerLayout->setColStretch( 1, 3);
129 headerLayout->setColStretch( 2, 1); 129 headerLayout->setColStretch( 2, 1);
130 } 130 }
131 131
132} 132}
133void KOEditorGeneral::setFocusOn( int i ) 133void KOEditorGeneral::setFocusOn( int i )
134{ 134{
135 mNextFocus = i; 135 mNextFocus = i;
136 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 136 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
137} 137}
138void KOEditorGeneral::slotSetFocusOn() 138void KOEditorGeneral::slotSetFocusOn()
139{ 139{
140 mNextFocus; 140 mNextFocus;
141 if ( mNextFocus == 1 ) { 141 if ( mNextFocus == 1 ) {
142 mDescriptionEdit->setFocus(); 142 mDescriptionEdit->setFocus();
143 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 143 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
144 } 144 }
145 if ( mNextFocus == 2 ) { 145 if ( mNextFocus == 2 ) {
146 mSummaryEdit->setFocus(); 146 mSummaryEdit->setFocus();
147 } 147 }
148} 148}
149void KOEditorGeneral::editCategories() 149void KOEditorGeneral::editCategories()
150{ 150{
151 // qDebug("KOEditorGeneral::editCategories() "); 151 // qDebug("KOEditorGeneral::editCategories() ");
152 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 152 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
153 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 153 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
154 //KOGlobals::fitDialogToScreen( csd ); 154 //KOGlobals::fitDialogToScreen( csd );
155 csd->setColorEnabled(); 155 csd->setColorEnabled();
156 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 156 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
157 csd->exec(); 157 csd->exec();
158 delete csd; 158 delete csd;
159} 159}
160 160
161void KOEditorGeneral::showCatPopup() 161void KOEditorGeneral::showCatPopup()
162{ 162{
163 mCatPopup->clear(); 163 mCatPopup->clear();
164 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 164 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
165 int index = 0; 165 int index = 0;
166 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 166 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
167 it != KOPrefs::instance()->mCustomCategories.end (); 167 it != KOPrefs::instance()->mCustomCategories.end ();
168 ++it) { 168 ++it) {
169 mCatPopup->insertItem (*it, index ); 169 mCatPopup->insertItem (*it, index );
170 //mCategory[index] = *it; 170 //mCategory[index] = *it;
171 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 171 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
172 ++index; 172 ++index;
173 } 173 }
174} 174}
175void KOEditorGeneral::selectedCatPopup( int index ) 175void KOEditorGeneral::selectedCatPopup( int index )
176{ 176{
177 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 177 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
178 QString colcat = categories.first(); 178 QString colcat = categories.first();
179 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 179 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
180 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 180 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
181 else 181 else
182 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 182 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
183 categories.sort (); 183 categories.sort ();
184 if ( !colcat.isEmpty() ) { 184 if ( !colcat.isEmpty() ) {
185 if ( categories.find ( colcat ) != categories.end () ) { 185 if ( categories.find ( colcat ) != categories.end () ) {
186 categories.remove( colcat ); 186 categories.remove( colcat );
187 categories.prepend( colcat ); 187 categories.prepend( colcat );
188 } 188 }
189 } 189 }
190 setCategories( categories.join(",") ); 190 setCategories( categories.join(",") );
191} 191}
192 192
193void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 193void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
194{ 194{
195 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 195 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
196 mCatPopup = new QPopupMenu ( parent ); 196 mCatPopup = new QPopupMenu ( parent );
197 mCatPopup->setCheckable (true); 197 mCatPopup->setCheckable (true);
198 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 198 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
199 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 199 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
200 mCategoriesButton = new QPushButton(parent); 200 mCategoriesButton = new QPushButton(parent);
201 mCategoriesButton->setText(i18n("Categories...")); 201 mCategoriesButton->setText(i18n("Categories..."));
202 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 202 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
203 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 203 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
204 categoriesLayout->addWidget(mCategoriesButton); 204 categoriesLayout->addWidget(mCategoriesButton);
205 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 205 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
206 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 206 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
207 mCategoriesLabel->setPopup( mCatPopup ); 207 mCategoriesLabel->setPopup( mCatPopup );
208 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 208 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
209 categoriesLayout->addWidget(mCategoriesLabel,1); 209 categoriesLayout->addWidget(mCategoriesLabel,1);
210} 210}
211 211
212void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 212void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
213{ 213{
214 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 214 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
215 215
216 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 216 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
217 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 217 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
218 secrecyLayout->addWidget(mCancelBox); 218 secrecyLayout->addWidget(mCancelBox);
219 secrecyLayout->addWidget(secrecyLabel); 219 secrecyLayout->addWidget(secrecyLabel);
220 220
221 mSecrecyCombo = new QComboBox(parent); 221 mSecrecyCombo = new QComboBox(parent);
222 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 222 mSecrecyCombo->insertStringList(Incidence::secrecyList());
223 secrecyLayout->addWidget(mSecrecyCombo); 223 secrecyLayout->addWidget(mSecrecyCombo);
224} 224}
225 225
226void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 226void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
227{ 227{
228 mDescriptionEdit = new KTextEdit(parent); 228 mDescriptionEdit = new KTextEdit(parent);
229 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 229 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
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 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
487 while ( kkf ) { 487 while ( kkf ) {
488 if ( mCalendarBox->currentText() == kkf->mName) 488 if ( mCalendarBox->currentText() == kkf->mName)
489 return kkf->mCalNumber; 489 return kkf->mCalNumber;
490 kkf = KOPrefs::instance()->mCalendars.next(); 490 kkf = KOPrefs::instance()->mCalendars.next();
491 } 491 }
492 return 1; 492 return 1;
493} 493}
494 494
495void KOEditorGeneral::readIncidence(Incidence *event) 495void KOEditorGeneral::readIncidence(Incidence *event)
496{ 496{
497 fillCalCombo( event->calID() ); 497 fillCalCombo( event->calID() );
498 mAlarmMessage = event->summary(); 498 mAlarmMessage = event->summary();
499 if ( ! event->location().isEmpty() ) 499 if ( ! event->location().isEmpty() )
500 mAlarmMessage += " ("+event->location()+")"; 500 mAlarmMessage += " ("+event->location()+")";
501 mAlarmIncrCombo->setCurrentItem(0); 501 mAlarmIncrCombo->setCurrentItem(0);
502 mSummaryEdit->setEditText(event->summary()); 502 mSummaryEdit->setEditText(event->summary());
503 mLocationEdit->setEditText(event->location()); 503 mLocationEdit->setEditText(event->location());
504 mDescriptionEdit->setText(event->description()); 504 mDescriptionEdit->setText(event->description());
505 505
506#if 0 506#if 0
507 // organizer information 507 // organizer information
508 mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); 508 mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
509#endif 509#endif
510 510
511 enableAlarmEdit( event->isAlarmEnabled() ); 511 enableAlarmEdit( event->isAlarmEnabled() );
512 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); 512 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
513 if(!event->isAlarmEnabled()) { 513 if(!event->isAlarmEnabled()) {
514 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 514 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
515 int alarmTime; 515 int alarmTime;
516 int a[] = { 1,5,10,15,30,60,180, 1440 }; 516 int a[] = { 1,5,10,15,30,60,180, 1440 };
517 int index = KOPrefs::instance()->mAlarmTime; 517 int index = KOPrefs::instance()->mAlarmTime;
518 if (index < 0 || index > 7) { 518 if (index < 0 || index > 7) {
519 alarmTime = 15; 519 alarmTime = 15;
520 } else { 520 } else {
521 alarmTime = a[index]; 521 alarmTime = a[index];
522 } 522 }
523 mAlarmTimeEdit->setValue(alarmTime); 523 mAlarmTimeEdit->setValue(alarmTime);
524 } 524 }
525 mAlarmButton->setChecked( event->isAlarmEnabled() ); 525 mAlarmButton->setChecked( event->isAlarmEnabled() );
526 mSecrecyCombo->setCurrentItem(event->secrecy()); 526 mSecrecyCombo->setCurrentItem(event->secrecy());
527 mCancelBox->setChecked( event->cancelled() ); 527 mCancelBox->setChecked( event->cancelled() );
528 mAlarmProgramButton->setOn(false); 528 mAlarmProgramButton->setOn(false);
529 mAlarmSoundButton->setOn(false); 529 mAlarmSoundButton->setOn(false);
530 530
531 // set up alarm stuff 531 // set up alarm stuff
532 QPtrList<Alarm> alarms = event->alarms(); 532 QPtrList<Alarm> alarms = event->alarms();
533 Alarm* alarm; 533 Alarm* alarm;
534 mAlarmIncrCombo->setCurrentItem(0); 534 mAlarmIncrCombo->setCurrentItem(0);
535 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 535 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
536 int offset; 536 int offset;
537 if ( alarm->hasTime() ) { 537 if ( alarm->hasTime() ) {
538 QDateTime t = alarm->time(); 538 QDateTime t = alarm->time();
539 offset = event->dtStart().secsTo( t ); 539 offset = event->dtStart().secsTo( t );
540 } else { 540 } else {
541 offset = alarm->startOffset().asSeconds(); 541 offset = alarm->startOffset().asSeconds();
542 } 542 }
543 if ( offset != 0 ) { 543 if ( offset != 0 ) {
544 offset = offset / -60; // make minutes 544 offset = offset / -60; // make minutes
545 if (offset % 60 == 0) { // divides evenly into hours? 545 if (offset % 60 == 0) { // divides evenly into hours?
546 offset = offset / 60; 546 offset = offset / 60;
547 mAlarmIncrCombo->setCurrentItem(1); 547 mAlarmIncrCombo->setCurrentItem(1);
548 if (offset % 24 == 0) { // divides evenly into days? 548 if (offset % 24 == 0) { // divides evenly into days?
549 offset = offset / 24; 549 offset = offset / 24;
550 mAlarmIncrCombo->setCurrentItem(2); 550 mAlarmIncrCombo->setCurrentItem(2);
551 } 551 }
552 } 552 }
553 } 553 }
554 mAlarmTimeEdit->setValue( offset ); 554 mAlarmTimeEdit->setValue( offset );
555 if (alarm->type() == Alarm::Procedure) { 555 if (alarm->type() == Alarm::Procedure) {
556 556
557 mAlarmProgram = alarm->programFile(); 557 mAlarmProgram = alarm->programFile();
558 mAlarmProgramButton->setOn(true); 558 mAlarmProgramButton->setOn(true);
559 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 559 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
560 QToolTip::add(mAlarmProgramButton, dispStr); 560 QToolTip::add(mAlarmProgramButton, dispStr);
561 } 561 }
562 else if (alarm->type() == Alarm::Audio) { 562 else if (alarm->type() == Alarm::Audio) {
563 mAlarmSound = alarm->audioFile(); 563 mAlarmSound = alarm->audioFile();
564 if ( ! QFile::exists( mAlarmSound ) ) 564 if ( ! QFile::exists( mAlarmSound ) )
565 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 565 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
566 mAlarmSoundButton->setOn(true); 566 mAlarmSoundButton->setOn(true);
567 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 567 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
568 QToolTip::add(mAlarmSoundButton, dispStr); 568 QToolTip::add(mAlarmSoundButton, dispStr);
569 } 569 }
570 mAlarmButton->setChecked(alarm->enabled()); 570 mAlarmButton->setChecked(alarm->enabled());
571 enableAlarmEdit( alarm->enabled() ); 571 enableAlarmEdit( alarm->enabled() );
572 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 572 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
573 // TODO: Deal with multiple alarms 573 // TODO: Deal with multiple alarms
574 break; // For now, stop after the first alarm 574 break; // For now, stop after the first alarm
575 } 575 }
576 576
577 setCategories(event->categoriesStr()); 577 setCategories(event->categoriesStr());
578} 578}
579 579
580void KOEditorGeneral::writeIncidence(Incidence *event) 580void KOEditorGeneral::writeIncidence(Incidence *event)
581{ 581{
582 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 582 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
583 mLocationEdit->save(KOLocationBox::LOCATION); 583 mLocationEdit->save(KOLocationBox::LOCATION);
584 event->setSummary(mSummaryEdit->currentText()); 584 event->setSummary(mSummaryEdit->currentText());
585 event->setLocation(mLocationEdit->currentText()); 585 event->setLocation(mLocationEdit->currentText());
586 event->setDescription(mDescriptionEdit->text()); 586 event->setDescription(mDescriptionEdit->text());
587 event->setCategories(mCategoriesLabel->text()); 587 event->setCategories(mCategoriesLabel->text());
588 event->setSecrecy(mSecrecyCombo->currentItem()); 588 event->setSecrecy(mSecrecyCombo->currentItem());
589 event->setCancelled(mCancelBox->isChecked() );; 589 event->setCancelled(mCancelBox->isChecked() );;
590 // alarm stuff 590 // alarm stuff
591 if (mAlarmButton->isChecked()) { 591 if (mAlarmButton->isChecked()) {
592 if (event->alarms().count() == 0) 592 if (event->alarms().count() == 0)
593 event->newAlarm(); 593 event->newAlarm();
594 QPtrList<Alarm> alarms = event->alarms(); 594 QPtrList<Alarm> alarms = event->alarms();
595 Alarm *alarm; 595 Alarm *alarm;
596 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 596 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
597 alarm->setEnabled(true); 597 alarm->setEnabled(true);
598 int j = mAlarmTimeEdit->value()* -60; 598 int j = mAlarmTimeEdit->value()* -60;
599 if (mAlarmIncrCombo->currentItem() == 1) 599 if (mAlarmIncrCombo->currentItem() == 1)
600 j = j * 60; 600 j = j * 60;
601 else if (mAlarmIncrCombo->currentItem() == 2) 601 else if (mAlarmIncrCombo->currentItem() == 2)
602 j = j * (60 * 24); 602 j = j * (60 * 24);
603 alarm->setStartOffset( j ); 603 alarm->setStartOffset( j );
604 604
605 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { 605 if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
606 alarm->setProcedureAlarm(mAlarmProgram); 606 alarm->setProcedureAlarm(mAlarmProgram);
607 } 607 }
608 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 608 else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
609 alarm->setAudioAlarm(mAlarmSound); 609 alarm->setAudioAlarm(mAlarmSound);
610 else 610 else
611 alarm->setType(Alarm::Invalid); 611 alarm->setType(Alarm::Invalid);
612 //alarm->setAudioAlarm("default"); 612 //alarm->setAudioAlarm("default");
613 // TODO: Deal with multiple alarms 613 // TODO: Deal with multiple alarms
614 break; // For now, stop after the first alarm 614 break; // For now, stop after the first alarm
615 } 615 }
616 } else { 616 } else {
617 Alarm* alarm = event->alarms().first(); 617 Alarm* alarm = event->alarms().first();
618 if ( alarm ) { 618 if ( alarm ) {
619 alarm->setEnabled(false); 619 alarm->setEnabled(false);
620 alarm->setType(Alarm::Invalid); 620 alarm->setType(Alarm::Invalid);
621 } 621 }
622 } 622 }
623 event->setCalID( getCalendarID() ); 623 event->setCalID( getCalendarID() );
624} 624}
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 6fa9b23..9b0e748 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,235 +1,235 @@
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 );
54 QPushButton * newJournal = new QPushButton( vb );
55 QPixmap icon;
56 if ( QApplication::desktop()->width() < 321 )
57 icon = SmallIcon("ko16old");
58 else
59 icon = SmallIcon("ko24old");
60 newJournal->setPixmap (icon ) ;
61 int size = newJournal->sizeHint().height();
62 newJournal->setFixedSize( size, size );
63 mDateLabel = new QLabel ( vb );
64 mDateLabel->setMargin(1);
65 mDateLabel->setAlignment(AlignCenter);
53 QScrollView * sv = new QScrollView( this ); 66 QScrollView * sv = new QScrollView( this );
54 QHBoxLayout * hbl = new QHBoxLayout( this ); 67 QVBoxLayout * hbl = new QVBoxLayout( this );
68 hbl->addWidget( vb );
55 hbl->addWidget( sv ); 69 hbl->addWidget( sv );
56 parWid = new QWidget( sv->viewport() ); 70 parWid = new QWidget( sv->viewport() );
57 sv->addChild(parWid); 71 sv->addChild(parWid);
58 sv->setResizePolicy( QScrollView:: AutoOneFit ); 72 sv->setResizePolicy( QScrollView:: AutoOneFit );
59 mTopLayout = new QVBoxLayout(parWid); 73 mTopLayout = new QVBoxLayout(parWid);
60 QHBox * vb = new QHBox ( parWid ); 74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
61 QPushButton * newJournal = new QPushButton( vb ); 75 getNewEntry();
62 QPixmap icon;
63 if ( QApplication::desktop()->width() < 321 )
64 icon = SmallIcon("ko16old");
65 else
66 icon = SmallIcon("ko24old");
67 newJournal->setPixmap (icon ) ;
68 int size = newJournal->sizeHint().height();
69 newJournal->setFixedSize( size, size );
70 mDateLabel = new QLabel ( vb );
71 mTopLayout->addWidget( vb );
72 mDateLabel->setMargin(1);
73 mDateLabel->setAlignment(AlignCenter);
74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
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->setDate(mDate); 180 mEntry->setDate(mDate);
181 mEntry->setJournal(jl.at(iii)); 181 mEntry->setJournal(jl.at(iii));
182 mEntry->setVisibleMode( true ); 182 mEntry->setVisibleMode( true );
183 mEntry->show(); 183 mEntry->show();
184 mEntry = 0; 184 mEntry = 0;
185 } else { 185 } else {
186 mEntry->setDate(mDate); 186 mEntry->setDate(mDate);
187 mEntry->setJournal(jl.at(iii)); 187 mEntry->setJournal(jl.at(iii));
188 mEntry->setVisibleMode( true ); 188 mEntry->setVisibleMode( true );
189 mEntry->show(); 189 mEntry->show();
190 mEntry = jEntries.next(); 190 mEntry = jEntries.next();
191 } 191 }
192 ++iii; 192 ++iii;
193 } 193 }
194 while ( mEntry ) { 194 while ( mEntry ) {
195 mEntry->setDate(mDate); 195 mEntry->setDate(mDate);
196 mEntry->clear(); 196 mEntry->clear();
197 if ( mEntry != firstEntry ) { 197 if ( mEntry != firstEntry ) {
198 mEntry->hide(); 198 mEntry->hide();
199 mEntry->setVisibleMode( false ); 199 mEntry->setVisibleMode( false );
200 } 200 }
201 else { 201 else {
202 mEntry->setVisibleMode( true ); 202 mEntry->setVisibleMode( true );
203 mEntry->show(); 203 mEntry->show();
204 } 204 }
205 mEntry = jEntries.next(); 205 mEntry = jEntries.next();
206 } 206 }
207} 207}
208 208
209void KOJournalView::showDates(const QDate &start, const QDate &) 209void KOJournalView::showDates(const QDate &start, const QDate &)
210{ 210{
211 mDate = start; 211 mDate = start;
212 mDateLabel->setText(KGlobal::locale()->formatDate(mDate)); 212 mDateLabel->setText(KGlobal::locale()->formatDate(mDate));
213 QPtrList<Journal> jl = calendar()->journals4Date( start ); 213 QPtrList<Journal> jl = calendar()->journals4Date( start );
214 showList( jl ); 214 showList( jl );
215} 215}
216 216
217void KOJournalView::showEvents(QPtrList<Event>) 217void KOJournalView::showEvents(QPtrList<Event>)
218{ 218{
219 // After new creation of list view no events are selected. 219 // After new creation of list view no events are selected.
220// emit incidenceSelected( 0 ); 220// emit incidenceSelected( 0 );
221} 221}
222 222
223void KOJournalView::changeEventDisplay(Event *, int /*action*/) 223void KOJournalView::changeEventDisplay(Event *, int /*action*/)
224{ 224{
225 updateView(); 225 updateView();
226} 226}
227 227
228void KOJournalView::keyPressEvent ( QKeyEvent * e ) 228void KOJournalView::keyPressEvent ( QKeyEvent * e )
229{ 229{
230 //qDebug("keyPressEven "); 230 //qDebug("keyPressEven ");
231 if ( e->state() == Qt::ControlButton ) { 231 if ( e->state() == Qt::ControlButton ) {
232 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 232 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
233 e->ignore(); 233 e->ignore();
234 } 234 }
235} 235}
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp
index 35a8123..9d5aafc 100644
--- a/korganizer/kolocationbox.cpp
+++ b/korganizer/kolocationbox.cpp
@@ -1,96 +1,102 @@
1/* 1/*
2 Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> 2 Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de>
3 3
4 This file is part of KOrganizer/PI 4 This file is part of KOrganizer/PI
5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info> 6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#include "kolocationbox.h" 27#include "kolocationbox.h"
28#include <qstring.h> 28#include <qstring.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32 32
33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : 33KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) :
34 QComboBox( rw , parent ) 34 QComboBox( rw , parent )
35{ 35{
36 maxItems = _maxItems; 36 maxItems = _maxItems;
37 maxItems = 50; // sorry - hack from me to set maxitems globally to 30 37 //maxItems = 50; // sorry - hack from me to set maxitems globally to 30
38 setInsertionPolicy(AtTop); 38 setInsertionPolicy(AtTop);
39 setDuplicatesEnabled( FALSE ); 39 setDuplicatesEnabled( FALSE );
40 setMaxCount( maxItems ); 40 setMaxCount( maxItems );
41 setAutoCompletion( TRUE ); 41 setAutoCompletion( TRUE );
42 42
43} 43}
44 44
45KOLocationBox::~KOLocationBox() 45KOLocationBox::~KOLocationBox()
46{ 46{
47} 47}
48 48
49void KOLocationBox::load(int what) 49void KOLocationBox::load(int what)
50{ 50{
51 clear(); 51 clear();
52 // qDebug("load %d ",what ); 52 // qDebug("load %d ",what );
53 switch(what) { 53 switch(what) {
54 case LOCATION: 54 case LOCATION:
55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 ); 55 insertStringList( KOPrefs::instance()->mLocationDefaults, 0 );
56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 ); 56// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 );
57 break; // don't disable 57 break; // don't disable
58 case SUMMARYEVENT: 58 case SUMMARYEVENT:
59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 ); 59 insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 );
60 break; // don't disable 60 break; // don't disable
61 case SUMMARYTODO: 61 case SUMMARYTODO:
62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); 62 insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 );
63 break; // don't disable 63 break; // don't disable
64 case SUMMARYJOURNAL:
65 insertStringList( KOPrefs::instance()->mJournalSummaryUser, 0 );
66 break; // don't disable
64 } 67 }
65} 68}
66 69
67void KOLocationBox::save(int what) 70void KOLocationBox::save(int what)
68{ 71{
69 strlist.clear(); 72 strlist.clear();
70 for( int l = 0; l < count() ; l++ ) { 73 for( int l = 0; l < count() ; l++ ) {
71 strlist << text( l ); 74 strlist << text( l );
72 } 75 }
73 // strlist.sort(); 76 // strlist.sort();
74 QString currentLine = lineEdit()->text(); 77 QString currentLine = lineEdit()->text();
75 if ( !strlist.contains( currentLine ) ) 78 if ( !strlist.contains( currentLine ) )
76 strlist.prepend( currentLine ); 79 strlist.prepend( currentLine );
77 // qDebug("save %d ", what); 80 // qDebug("save %d ", what);
78 switch(what) { 81 switch(what) {
79 case LOCATION: 82 case LOCATION:
80 KOPrefs::instance()->mLocationDefaults = strlist; 83 KOPrefs::instance()->mLocationDefaults = strlist;
81// KOPrefs::instance()->mLocationUserDefaults = strlist; 84// KOPrefs::instance()->mLocationUserDefaults = strlist;
82 break; // don't disable 85 break; // don't disable
83 case SUMMARYEVENT: 86 case SUMMARYEVENT:
84 KOPrefs::instance()->mEventSummaryUser = strlist; 87 KOPrefs::instance()->mEventSummaryUser = strlist;
85 break; // don't disable 88 break; // don't disable
86 case SUMMARYTODO: 89 case SUMMARYTODO:
87 KOPrefs::instance()->mTodoSummaryUser = strlist; 90 KOPrefs::instance()->mTodoSummaryUser = strlist;
88 break; // don't disable 91 break; // don't disable
92 case SUMMARYJOURNAL:
93 KOPrefs::instance()->mJournalSummaryUser = strlist;
94 break; // don't disable
89 } 95 }
90} 96}
91 97
92void KOLocationBox::clearItems(int what) 98void KOLocationBox::clearItems(int what)
93{ 99{
94 clear(); 100 clear();
95 save(what); 101 save(what);
96} 102}
diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h
index b604d33..6a42de6 100644
--- a/korganizer/kolocationbox.h
+++ b/korganizer/kolocationbox.h
@@ -1,55 +1,55 @@
1/* 1/*
2 File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de> 2 File Copyright (c) 2004 Dirk Loesche <dirk.loesche@bigfoot.de>
3 3
4 This file is part of KOrganizer/PI 4 This file is part of KOrganizer/PI
5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 5 KOrganizer Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info> 6 KOrganizer/PI Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#ifndef KOLOCATIONBOX_H 27#ifndef KOLOCATIONBOX_H
28#define KOLOCATIONBOX_H 28#define KOLOCATIONBOX_H
29 29
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include "koprefs.h" 31#include "koprefs.h"
32 32
33class KOLocationBox : public QComboBox 33class KOLocationBox : public QComboBox
34{ 34{
35 public: 35 public:
36 KOLocationBox( bool rw , QWidget *parent , int _maxItems ); 36 KOLocationBox( bool rw , QWidget *parent , int _maxItems );
37 virtual ~KOLocationBox(); 37 virtual ~KOLocationBox();
38 38
39 enum {LOCATION, SUMMARYEVENT, SUMMARYTODO}; 39 enum {LOCATION, SUMMARYEVENT, SUMMARYTODO,SUMMARYJOURNAL};
40 40
41 public slots: 41 public slots:
42 void load(int); 42 void load(int);
43 void save(int); 43 void save(int);
44 void clearItems(int); // clear listbox and config rc items 44 void clearItems(int); // clear listbox and config rc items
45 45
46 protected: 46 protected:
47// void focusOutEvent( QFocusEvent * ); 47// void focusOutEvent( QFocusEvent * );
48// void timerEvent( QTimerEvent * ); 48// void timerEvent( QTimerEvent * );
49 49
50 private: 50 private:
51 int maxItems; // maximal listbox items 51 int maxItems; // maximal listbox items
52 QStringList strlist; // temporary stringlist 52 QStringList strlist; // temporary stringlist
53}; 53};
54 54
55#endif 55#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 6337ca5..bb3d720 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,603 +1,605 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 QColor defaultTodoRunColor = QColor(99,194,30); 65 QColor defaultTodoRunColor = QColor(99,194,30);
66 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
70 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
71 addItemBool("ShowIconList",&mShowIconList,true); 71 addItemBool("ShowIconList",&mShowIconList,true);
72 addItemBool("ShowIconDay1",&mShowIconDay1,true); 72 addItemBool("ShowIconDay1",&mShowIconDay1,true);
73 addItemBool("ShowIconDay5",&mShowIconDay5,true); 73 addItemBool("ShowIconDay5",&mShowIconDay5,true);
74 addItemBool("ShowIconDay6",&mShowIconDay6,true); 74 addItemBool("ShowIconDay6",&mShowIconDay6,true);
75 addItemBool("ShowIconDay7",&mShowIconDay7,true); 75 addItemBool("ShowIconDay7",&mShowIconDay7,true);
76 addItemBool("ShowIconMonth",&mShowIconMonth,true); 76 addItemBool("ShowIconMonth",&mShowIconMonth,true);
77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
79 addItemBool("ShowIconBack",&mShowIconBack,true); 79 addItemBool("ShowIconBack",&mShowIconBack,true);
80 addItemBool("ShowIconToday",&mShowIconToday,true); 80 addItemBool("ShowIconToday",&mShowIconToday,true);
81 addItemBool("ShowIconForward",&mShowIconForward,true); 81 addItemBool("ShowIconForward",&mShowIconForward,true);
82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
86 addItemBool("ShowIconNext",&mShowIconNext,true); 86 addItemBool("ShowIconNext",&mShowIconNext,true);
87 addItemBool("ShowIconJournal",&mShowIconJournal,true); 87 addItemBool("ShowIconJournal",&mShowIconJournal,true);
88 addItemBool("ShowIconStretch",&mShowIconStretch,true); 88 addItemBool("ShowIconStretch",&mShowIconStretch,true);
89 addItemBool("ShowIconFilter",&mShowIconFilter,false); 89 addItemBool("ShowIconFilter",&mShowIconFilter,false);
90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); 90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true);
91 91
92 bool addIcons = false; 92 bool addIcons = false;
93#ifdef DESKTOP_VERSION 93#ifdef DESKTOP_VERSION
94 addIcons = true; 94 addIcons = true;
95#endif 95#endif
96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); 96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons);
97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); 97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons);
98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); 98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons);
99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); 99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons);
100 100
101 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 101 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
102 102
103 addItemBool("AskForQuit",&mAskForQuit,false); 103 addItemBool("AskForQuit",&mAskForQuit,false);
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106 addItemBool("ShowFullMenu",&mShowFullMenu,false); 106 addItemBool("ShowFullMenu",&mShowFullMenu,false);
107#else 107#else
108 addItemBool("ShowFullMenu",&mShowFullMenu,true); 108 addItemBool("ShowFullMenu",&mShowFullMenu,true);
109#endif 109#endif
110 addItemBool("ToolBarHor",&mToolBarHor, true ); 110 addItemBool("ToolBarHor",&mToolBarHor, true );
111 addItemBool("ToolBarUp",&mToolBarUp, false ); 111 addItemBool("ToolBarUp",&mToolBarUp, false );
112 addItemBool("ToolBarHorV",&mToolBarHorV, true ); 112 addItemBool("ToolBarHorV",&mToolBarHorV, true );
113 addItemBool("ToolBarUpV",&mToolBarUpV, false ); 113 addItemBool("ToolBarUpV",&mToolBarUpV, false );
114 addItemBool("ToolBarHorN",&mToolBarHorN, true ); 114 addItemBool("ToolBarHorN",&mToolBarHorN, true );
115 addItemBool("ToolBarUpN",&mToolBarUpN, false ); 115 addItemBool("ToolBarUpN",&mToolBarUpN, false );
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 116 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 117 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 119 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 121
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); 123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true);
124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
127 addItemInt("AllDay Size",&mAllDaySize,28); 127 addItemInt("AllDay Size",&mAllDaySize,28);
128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
130 130
131 addItemStringList("LocationDefaults",&mLocationDefaults ); 131 addItemStringList("LocationDefaults",&mLocationDefaults );
132 addItemStringList("EventSummary User",&mEventSummaryUser); 132 addItemStringList("EventSummary User",&mEventSummaryUser);
133 addItemStringList("TodoSummary User",&mTodoSummaryUser); 133 addItemStringList("TodoSummary User",&mTodoSummaryUser);
134 addItemStringList("JournalSummary User",&mJournalSummaryUser);
134 135
135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 136 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
136 addItemBool("Enable Project View",&mEnableProjectView,false); 137 addItemBool("Enable Project View",&mEnableProjectView,false);
137 addItemBool("Auto Save",&mAutoSave,false); 138 addItemBool("Auto Save",&mAutoSave,false);
138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 139 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
139 addItemBool("Confirm Deletes",&mConfirm,true); 140 addItemBool("Confirm Deletes",&mConfirm,true);
140 addItemString("Archive File",&mArchiveFile); 141 addItemString("Archive File",&mArchiveFile);
141 addItemString("Html Export File",&mHtmlExportFile, 142 addItemString("Html Export File",&mHtmlExportFile,
142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 143 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
143 addItemBool("Html With Save",&mHtmlWithSave,false); 144 addItemBool("Html With Save",&mHtmlWithSave,false);
144 145
145 KPrefs::setCurrentGroup("Personal Settings"); 146 KPrefs::setCurrentGroup("Personal Settings");
146 147
147 addItemInt("Mail Client",&mMailClient,MailClientKMail); 148 addItemInt("Mail Client",&mMailClient,MailClientKMail);
148 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 149 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
149 addItemBool("Bcc",&mBcc,false); 150 addItemBool("Bcc",&mBcc,false);
150 151
151 KPrefs::setCurrentGroup("Time & Date"); 152 KPrefs::setCurrentGroup("Time & Date");
152 153
153 154
154 addItemInt("Default Start Time",&mStartTime,10); 155 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 156 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 157 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 KPrefs::setCurrentGroup("AlarmSettings"); 158 KPrefs::setCurrentGroup("AlarmSettings");
158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
162 163
163 164
164 KPrefs::setCurrentGroup("Calendar"); 165 KPrefs::setCurrentGroup("Calendar");
165 166
166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
167 168
168 KPrefs::setCurrentGroup("Fonts"); 169 KPrefs::setCurrentGroup("Fonts");
169 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 170 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
170 QFont fon = KGlobalSettings::generalFont(); 171 QFont fon = KGlobalSettings::generalFont();
171 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 172 addItemFont("TimeBar Font",&mTimeBarFont,fon );
172 addItemFont("MonthView Font",&mMonthViewFont,fon); 173 addItemFont("MonthView Font",&mMonthViewFont,fon);
173 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 174 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 175 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 176 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
176 addItemFont("TodoView Font",&mTodoViewFont,fon); 177 addItemFont("TodoView Font",&mTodoViewFont,fon);
177 addItemFont("ListView Font",&mListViewFont,fon); 178 addItemFont("ListView Font",&mListViewFont,fon);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 179 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
179 addItemFont("EditBox Font",&mEditBoxFont,fon); 180 addItemFont("EditBox Font",&mEditBoxFont,fon);
180 addItemFont("JournalView Font",&mJornalViewFont,fon); 181 addItemFont("JournalView Font",&mJornalViewFont,fon);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 182 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
182 addItemFont("EventView Font",&mEventViewFont,fon); 183 addItemFont("EventView Font",&mEventViewFont,fon);
183 184
184 KPrefs::setCurrentGroup("RemoteSyncing"); 185 KPrefs::setCurrentGroup("RemoteSyncing");
185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 186 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 187 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 188 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
188 addItemInt("LastSyncTime",&mLastSyncTime,0); 189 addItemInt("LastSyncTime",&mLastSyncTime,0);
189 190
190#ifdef _WIN32_ 191#ifdef _WIN32_
191 QString hdp= locateLocal("data","korganizer")+"\\\\"; 192 QString hdp= locateLocal("data","korganizer")+"\\\\";
192#else 193#else
193 QString hdp= locateLocal("data","korganizer")+"/"; 194 QString hdp= locateLocal("data","korganizer")+"/";
194#endif 195#endif
195 196
196 KPrefs::setCurrentGroup("LoadSaveFileNames"); 197 KPrefs::setCurrentGroup("LoadSaveFileNames");
197 198
198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 199 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 200 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 201 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 202 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
202 203
203 204
204 KPrefs::setCurrentGroup("Locale"); 205 KPrefs::setCurrentGroup("Locale");
205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 206 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
206 207
207 208
208 KPrefs::setCurrentGroup("Colors"); 209 KPrefs::setCurrentGroup("Colors");
209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 210 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 211 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 212 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 213 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 214 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 215 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 216 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 217 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 218 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 219 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 220 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 221 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 222 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 223 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
223 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 224 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 225 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 226 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 227 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
227 addItemBool("UseAppColors",&mUseAppColors,false); 228 addItemBool("UseAppColors",&mUseAppColors,false);
228 229
229 230
230 231
231 KPrefs::setCurrentGroup("Views"); 232 KPrefs::setCurrentGroup("Views");
232 addItemBool("Block Popup Menu",&mBlockPopupMenu,false); 233 addItemBool("Block Popup Menu",&mBlockPopupMenu,false);
233 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 234 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
234 addItemInt("Hour Size",&mHourSize,8); 235 addItemInt("Hour Size",&mHourSize,8);
235 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 236 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 237 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 238 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 239 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
239 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 240 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 241 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 242 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
242#ifdef DESKTOP_VERION 243#ifdef DESKTOP_VERION
243 addItemBool("Enable ToolTips",&mEnableToolTips,true); 244 addItemBool("Enable ToolTips",&mEnableToolTips,true);
244#else 245#else
245 addItemBool("Enable ToolTips",&mEnableToolTips,false); 246 addItemBool("Enable ToolTips",&mEnableToolTips,false);
246#endif 247#endif
247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 248 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 249 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 250 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 251 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 252 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 253 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 254 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 255 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 256 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 257 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 258 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 259 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 260 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 261 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 262 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 263 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 264 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 265 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 266 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 267 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
267#ifdef DESKTOP_VERSION 268#ifdef DESKTOP_VERSION
268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
269#else 270#else
270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 271 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
271#endif 272#endif
272 addItemInt("Day Begins",&mDayBegins,7); 273 addItemInt("Day Begins",&mDayBegins,7);
273 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 274 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
274 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 275 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
275 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 276 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 277 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
277 278
278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 279 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
279 addItemBool("Full View Month",&mFullViewMonth,true); 280 addItemBool("Full View Month",&mFullViewMonth,true);
280 addItemBool("Full View Todo",&mFullViewTodo,true); 281 addItemBool("Full View Todo",&mFullViewTodo,true);
281 addItemBool("Quick Todo",&mEnableQuickTodo,false); 282 addItemBool("Quick Todo",&mEnableQuickTodo,false);
282 283
283 addItemInt("Next X Days",&mNextXDays,3); 284 addItemInt("Next X Days",&mNextXDays,3);
284 285
285 KPrefs::setCurrentGroup("Printer"); 286 KPrefs::setCurrentGroup("Printer");
286 287
287 KPrefs::setCurrentGroup("Layout"); 288 KPrefs::setCurrentGroup("Layout");
288 289
289 addItemBool("CompactDialogs",&mCompactDialogs,false); 290 addItemBool("CompactDialogs",&mCompactDialogs,false);
290 addItemBool("VerticalScreen",&mVerticalScreen,true); 291 addItemBool("VerticalScreen",&mVerticalScreen,true);
291 292
292 KPrefs::setCurrentGroup("KOrganizer Plugins"); 293 KPrefs::setCurrentGroup("KOrganizer Plugins");
293 294
294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 295 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
295 296
296 KPrefs::setCurrentGroup("Group Scheduling"); 297 KPrefs::setCurrentGroup("Group Scheduling");
297 298
298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 299 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 300 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
300 addItemStringList("AdditionalMails",&mAdditionalMails,""); 301 addItemStringList("AdditionalMails",&mAdditionalMails,"");
301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 302 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 303 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 304 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 305 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 306 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
306 307
307 KPrefs::setCurrentGroup( "Editors" ); 308 KPrefs::setCurrentGroup( "Editors" );
308 309
309 addItemStringList( "EventTemplates", &mEventTemplates ); 310 addItemStringList( "EventTemplates", &mEventTemplates );
310 addItemStringList( "TodoTemplates", &mTodoTemplates ); 311 addItemStringList( "TodoTemplates", &mTodoTemplates );
311 312
312 addItemInt("DestinationPolicy",&mDestination,standardDestination); 313 addItemInt("DestinationPolicy",&mDestination,standardDestination);
313 314
314 KPrefs::setCurrentGroup( "ViewOptions" ); 315 KPrefs::setCurrentGroup( "ViewOptions" );
315 addItemBool("EVshowDetails",&mEVshowDetails,true); 316 addItemBool("EVshowDetails",&mEVshowDetails,true);
316 addItemBool("EVshowCreated",&mEVshowCreated,true); 317 addItemBool("EVshowCreated",&mEVshowCreated,true);
317 addItemBool("EVshowChanged",&mEVshowChanged,true); 318 addItemBool("EVshowChanged",&mEVshowChanged,true);
318 addItemBool("WTshowDetails",&mWTshowDetails,false); 319 addItemBool("WTshowDetails",&mWTshowDetails,false);
319 addItemBool("WTshowCreated",&mWTshowCreated,false); 320 addItemBool("WTshowCreated",&mWTshowCreated,false);
320 addItemBool("WTshowChanged",&mWTshowChanged,false); 321 addItemBool("WTshowChanged",&mWTshowChanged,false);
321 mCalendars.setAutoDelete( true ); 322 mCalendars.setAutoDelete( true );
322} 323}
323 324
324 325
325KOPrefs::~KOPrefs() 326KOPrefs::~KOPrefs()
326{ 327{
327 if (mInstance == this) 328 if (mInstance == this)
328 mInstance = insd.setObject(0); 329 mInstance = insd.setObject(0);
329 mCalendars.setAutoDelete( true ); 330 mCalendars.setAutoDelete( true );
330 mCalendars.clear(); 331 mCalendars.clear();
331 //qDebug("KOPrefs::~KOPrefs() "); 332 //qDebug("KOPrefs::~KOPrefs() ");
332} 333}
333 334
334 335
335KOPrefs *KOPrefs::instance() 336KOPrefs *KOPrefs::instance()
336{ 337{
337 if (!mInstance) { 338 if (!mInstance) {
338 mInstance = insd.setObject(new KOPrefs()); 339 mInstance = insd.setObject(new KOPrefs());
339 mInstance->readConfig(); 340 mInstance->readConfig();
340 } 341 }
341 342
342 return mInstance; 343 return mInstance;
343} 344}
344 345
345void KOPrefs::usrSetDefaults() 346void KOPrefs::usrSetDefaults()
346{ 347{
347 348
348} 349}
349 350
350void KOPrefs::fillMailDefaults() 351void KOPrefs::fillMailDefaults()
351{ 352{
352 if (mName.isEmpty()) mName = i18n("Anonymous"); 353 if (mName.isEmpty()) mName = i18n("Anonymous");
353 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 354 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
354} 355}
355 356
356void KOPrefs::setTimeZoneIdDefault() 357void KOPrefs::setTimeZoneIdDefault()
357{ 358{
358 ; 359 ;
359} 360}
360 361
361void KOPrefs::setAllDefaults() 362void KOPrefs::setAllDefaults()
362{ 363{
363 setCategoryDefaults(); 364 setCategoryDefaults();
364 mEventSummaryUser = getDefaultList() ; 365 mEventSummaryUser = getDefaultList() ;
365 mTodoSummaryUser = getDefaultList() ; 366 mTodoSummaryUser = getDefaultList() ;
367 mJournalSummaryUser = getDefaultList() ;
366 mLocationDefaults = getLocationDefaultList(); 368 mLocationDefaults = getLocationDefaultList();
367} 369}
368 370
369void KOPrefs::setCategoryDefaults() 371void KOPrefs::setCategoryDefaults()
370{ 372{
371 mCustomCategories.clear(); 373 mCustomCategories.clear();
372 mCustomCategories = getDefaultList(); 374 mCustomCategories = getDefaultList();
373 375
374 QStringList::Iterator it; 376 QStringList::Iterator it;
375 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 377 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
376 setCategoryColor(*it,mDefaultCategoryColor); 378 setCategoryColor(*it,mDefaultCategoryColor);
377 } 379 }
378} 380}
379QStringList KOPrefs::getLocationDefaultList() 381QStringList KOPrefs::getLocationDefaultList()
380{ 382{
381 QStringList retval ; 383 QStringList retval ;
382 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")
383 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 385 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
384 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 386 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
385 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 387 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
386 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 388 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
387 389
388 retval.sort(); 390 retval.sort();
389 return retval; 391 return retval;
390} 392}
391QStringList KOPrefs::getDefaultList() 393QStringList KOPrefs::getDefaultList()
392{ 394{
393 QStringList retval ; 395 QStringList retval ;
394 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") 396 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer")
395 << i18n("Break") 397 << i18n("Break")
396 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") 398 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts")
397 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") 399 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts")
398 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") 400 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal")
399 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") 401 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping")
400 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") 402 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")
401 << i18n("Vacation") ; 403 << i18n("Vacation") ;
402 retval.sort(); 404 retval.sort();
403 //qDebug("cat %s ", retval.join("-").latin1()); 405 //qDebug("cat %s ", retval.join("-").latin1());
404 return retval; 406 return retval;
405} 407}
406// << 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")
407void KOPrefs::usrReadConfig() 409void KOPrefs::usrReadConfig()
408{ 410{
409 config()->setGroup("General"); 411 config()->setGroup("General");
410 412
411 //qDebug("KOPrefs::usrReadConfig() "); 413 //qDebug("KOPrefs::usrReadConfig() ");
412 mCustomCategories = config()->readListEntry("Custom Categories"); 414 mCustomCategories = config()->readListEntry("Custom Categories");
413 mOldLoadedLanguage = mOldLanguage ; 415 mOldLoadedLanguage = mOldLanguage ;
414 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 416 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
415 if (mLocationDefaults.isEmpty()) { 417 if (mLocationDefaults.isEmpty()) {
416 mLocationDefaults = getLocationDefaultList(); 418 mLocationDefaults = getLocationDefaultList();
417 } 419 }
418 420
419 if (mEventSummaryUser.isEmpty()) { 421 if (mEventSummaryUser.isEmpty()) {
420 mEventSummaryUser = getDefaultList() ; 422 mEventSummaryUser = getDefaultList() ;
421 } 423 }
422 if (mTodoSummaryUser.isEmpty()) { 424 if (mTodoSummaryUser.isEmpty()) {
423 mTodoSummaryUser = getDefaultList() ; 425 mTodoSummaryUser = getDefaultList() ;
424 } 426 }
425 427
426 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 428 if (mCustomCategories.isEmpty()) setCategoryDefaults();
427 429
428 config()->setGroup("Personal Settings"); 430 config()->setGroup("Personal Settings");
429 mName = config()->readEntry("user_name",""); 431 mName = config()->readEntry("user_name","");
430 mEmail = config()->readEntry("user_email",""); 432 mEmail = config()->readEntry("user_email","");
431 fillMailDefaults(); 433 fillMailDefaults();
432 434
433 config()->setGroup("Category Colors"); 435 config()->setGroup("Category Colors");
434 QStringList::Iterator it; 436 QStringList::Iterator it;
435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 437 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 438 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
437 439
438 } 440 }
439 KConfig fc (locateLocal("config","kopicalendarrc")); 441 KConfig fc (locateLocal("config","kopicalendarrc"));
440 fc.setGroup("CC"); 442 fc.setGroup("CC");
441 int numCals = fc.readNumEntry("NumberCalendars",0 ); 443 int numCals = fc.readNumEntry("NumberCalendars",0 );
442 mNextAvailableCalendar = 1; 444 mNextAvailableCalendar = 1;
443 if ( numCals == 0 ) { 445 if ( numCals == 0 ) {
444 KopiCalendarFile *kkf = getNewCalendar(); 446 KopiCalendarFile *kkf = getNewCalendar();
445 kkf->isStandard = true; 447 kkf->isStandard = true;
446 kkf->mName = i18n("Standard"); 448 kkf->mName = i18n("Standard");
447 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
448 } 450 }
449 while ( mNextAvailableCalendar <= numCals ) { 451 while ( mNextAvailableCalendar <= numCals ) {
450 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 452 //qDebug("Read cal #%d ", mNextAvailableCalendar );
451 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
452 KopiCalendarFile *kkf = getNewCalendar(); 454 KopiCalendarFile *kkf = getNewCalendar();
453 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
454 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
455 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 457 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
456 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 458 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
457 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 459 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
458 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 460 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
459 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 461 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
460 if ( kkf->mCalNumber == 1 ) { 462 if ( kkf->mCalNumber == 1 ) {
461 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 463 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
462 } 464 }
463 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 465 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
464 if ( kkf->mName == i18n("Birthdays") ) { 466 if ( kkf->mName == i18n("Birthdays") ) {
465 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 467 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
466 } 468 }
467 } 469 }
468 470
469 KPimPrefs::usrReadConfig(); 471 KPimPrefs::usrReadConfig();
470} 472}
471 473
472KopiCalendarFile * KOPrefs::getCalendar( int num ) 474KopiCalendarFile * KOPrefs::getCalendar( int num )
473{ 475{
474 return mDefCalColors[num-1]; 476 return mDefCalColors[num-1];
475} 477}
476 478
477KopiCalendarFile * KOPrefs::getNewCalendar() 479KopiCalendarFile * KOPrefs::getNewCalendar()
478{ 480{
479 KopiCalendarFile * kkf = new KopiCalendarFile(); 481 KopiCalendarFile * kkf = new KopiCalendarFile();
480 kkf->mCalNumber = mNextAvailableCalendar; 482 kkf->mCalNumber = mNextAvailableCalendar;
481 mDefCalColors.resize( mNextAvailableCalendar ); 483 mDefCalColors.resize( mNextAvailableCalendar );
482 mDefCalColors[mNextAvailableCalendar-1] = kkf; 484 mDefCalColors[mNextAvailableCalendar-1] = kkf;
483 ++mNextAvailableCalendar; 485 ++mNextAvailableCalendar;
484 kkf->mDefaultColor = mEventColor; 486 kkf->mDefaultColor = mEventColor;
485 kkf->mName = i18n("New Calendar"); 487 kkf->mName = i18n("New Calendar");
486 mCalendars.append( kkf ); 488 mCalendars.append( kkf );
487 return kkf; 489 return kkf;
488} 490}
489void KOPrefs::deleteCalendar( int num ) 491void KOPrefs::deleteCalendar( int num )
490{ 492{
491 KopiCalendarFile * kkf = mCalendars.first(); 493 KopiCalendarFile * kkf = mCalendars.first();
492 while ( kkf ) { 494 while ( kkf ) {
493 if ( kkf->mCalNumber == num ) { 495 if ( kkf->mCalNumber == num ) {
494 qDebug("KOPrefs::deleteCalendar %d ", num ); 496 qDebug("KOPrefs::deleteCalendar %d ", num );
495 mCalendars.remove( kkf ); 497 mCalendars.remove( kkf );
496 delete kkf; 498 delete kkf;
497 return; 499 return;
498 } 500 }
499 kkf = mCalendars.next(); 501 kkf = mCalendars.next();
500 } 502 }
501} 503}
502QString KOPrefs::calName( int calNum) const 504QString KOPrefs::calName( int calNum) const
503{ 505{
504 return (mDefCalColors[calNum-1])->mName; 506 return (mDefCalColors[calNum-1])->mName;
505} 507}
506QColor KOPrefs::defaultColor( int calNum ) const 508QColor KOPrefs::defaultColor( int calNum ) const
507{ 509{
508 if ( calNum == 1 ) return mEventColor; 510 if ( calNum == 1 ) return mEventColor;
509 return (mDefCalColors[calNum-1])->mDefaultColor; 511 return (mDefCalColors[calNum-1])->mDefaultColor;
510} 512}
511void KOPrefs::usrWriteConfig() 513void KOPrefs::usrWriteConfig()
512{ 514{
513 config()->setGroup("General"); 515 config()->setGroup("General");
514 config()->writeEntry("Custom Categories",mCustomCategories); 516 config()->writeEntry("Custom Categories",mCustomCategories);
515 517
516 config()->setGroup("Personal Settings"); 518 config()->setGroup("Personal Settings");
517 config()->writeEntry("user_name",mName); 519 config()->writeEntry("user_name",mName);
518 config()->writeEntry("user_email",mEmail); 520 config()->writeEntry("user_email",mEmail);
519 521
520 config()->setGroup("Category Colors"); 522 config()->setGroup("Category Colors");
521 QDictIterator<QColor> it(mCategoryColors); 523 QDictIterator<QColor> it(mCategoryColors);
522 while (it.current()) { 524 while (it.current()) {
523 config()->writeEntry(it.currentKey(),*(it.current())); 525 config()->writeEntry(it.currentKey(),*(it.current()));
524 ++it; 526 ++it;
525 } 527 }
526 KConfig fc (locateLocal("config","kopicalendarrc")); 528 KConfig fc (locateLocal("config","kopicalendarrc"));
527 fc.setGroup("CC"); 529 fc.setGroup("CC");
528 fc.writeEntry("NumberCalendars",mCalendars.count()); 530 fc.writeEntry("NumberCalendars",mCalendars.count());
529 int numCal = 1; 531 int numCal = 1;
530 int writeCal = 0; 532 int writeCal = 0;
531 while ( numCal < mNextAvailableCalendar ) { 533 while ( numCal < mNextAvailableCalendar ) {
532 KopiCalendarFile * kkf = mCalendars.first(); 534 KopiCalendarFile * kkf = mCalendars.first();
533 while ( kkf ) { 535 while ( kkf ) {
534 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 536 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
535 if ( kkf->mCalNumber == numCal ) { 537 if ( kkf->mCalNumber == numCal ) {
536 ++writeCal; 538 ++writeCal;
537 //qDebug("Write calendar %d %d ", numCal , writeCal); 539 //qDebug("Write calendar %d %d ", numCal , writeCal);
538 QString prefix = "Cal_" + QString::number( writeCal ); 540 QString prefix = "Cal_" + QString::number( writeCal );
539 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 541 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
540 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 542 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
541 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 543 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
542 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 544 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
543 fc.writeEntry( prefix+"_Name", kkf->mName); 545 fc.writeEntry( prefix+"_Name", kkf->mName);
544 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 546 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
545 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 547 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
546 } 548 }
547 kkf = mCalendars.next(); 549 kkf = mCalendars.next();
548 } 550 }
549 ++numCal; 551 ++numCal;
550 } 552 }
551 fc.sync(); 553 fc.sync();
552 KPimPrefs::usrWriteConfig(); 554 KPimPrefs::usrWriteConfig();
553} 555}
554 556
555void KOPrefs::setCategoryColor(QString cat,const QColor & color) 557void KOPrefs::setCategoryColor(QString cat,const QColor & color)
556{ 558{
557 mCategoryColors.replace(cat,new QColor(color)); 559 mCategoryColors.replace(cat,new QColor(color));
558} 560}
559 561
560QColor *KOPrefs::categoryColor(QString cat) 562QColor *KOPrefs::categoryColor(QString cat)
561{ 563{
562 QColor *color = 0; 564 QColor *color = 0;
563 565
564 if (!cat.isEmpty()) color = mCategoryColors[cat]; 566 if (!cat.isEmpty()) color = mCategoryColors[cat];
565 567
566 if (color) return color; 568 if (color) return color;
567 else return &mDefaultCategoryColor; 569 else return &mDefaultCategoryColor;
568} 570}
569 571
570void KOPrefs::setFullName(const QString &name) 572void KOPrefs::setFullName(const QString &name)
571{ 573{
572 mName = name; 574 mName = name;
573} 575}
574 576
575void KOPrefs::setEmail(const QString &email) 577void KOPrefs::setEmail(const QString &email)
576{ 578{
577 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 579 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
578 mEmail = email; 580 mEmail = email;
579} 581}
580 582
581QString KOPrefs::fullName() 583QString KOPrefs::fullName()
582{ 584{
583 if (mEmailControlCenter) { 585 if (mEmailControlCenter) {
584 KEMailSettings settings; 586 KEMailSettings settings;
585 return settings.getSetting(KEMailSettings::RealName); 587 return settings.getSetting(KEMailSettings::RealName);
586 } else { 588 } else {
587 return mName; 589 return mName;
588 } 590 }
589} 591}
590 592
591QString KOPrefs::email() 593QString KOPrefs::email()
592{ 594{
593 if (mEmailControlCenter) { 595 if (mEmailControlCenter) {
594 KEMailSettings settings; 596 KEMailSettings settings;
595 return settings.getSetting(KEMailSettings::EmailAddress); 597 return settings.getSetting(KEMailSettings::EmailAddress);
596 } else { 598 } else {
597 return mEmail; 599 return mEmail;
598 } 600 }
599} 601}
600KConfig* KOPrefs::getConfig() 602KConfig* KOPrefs::getConfig()
601{ 603{
602 return config(); 604 return config();
603} 605}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 5cc9bfa..53d193b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,356 +1,357 @@
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 protected: 103 protected:
104 void setTimeZoneIdDefault(); 104 void setTimeZoneIdDefault();
105 105
106 /** Fill empty mail fields with default values. */ 106 /** Fill empty mail fields with default values. */
107 void fillMailDefaults(); 107 void fillMailDefaults();
108 108
109 private: 109 private:
110 /** Constructor disabled for public. Use instance() to create a KOPrefs 110 /** Constructor disabled for public. Use instance() to create a KOPrefs
111 object. */ 111 object. */
112 KOPrefs(); 112 KOPrefs();
113 113
114 static KOPrefs *mInstance; 114 static KOPrefs *mInstance;
115 QStringList getDefaultList(); 115 QStringList getDefaultList();
116 QStringList getLocationDefaultList(); 116 QStringList getLocationDefaultList();
117 public: 117 public:
118 // preferences data 118 // preferences data
119 KConfig* getConfig(); 119 KConfig* getConfig();
120 void setFullName(const QString &); 120 void setFullName(const QString &);
121 QString fullName(); 121 QString fullName();
122 void setEmail(const QString &); 122 void setEmail(const QString &);
123 QString email(); 123 QString email();
124 124
125 QString mAdditional; 125 QString mAdditional;
126 126
127 bool mEmailControlCenter; 127 bool mEmailControlCenter;
128 128
129 bool mBcc; 129 bool mBcc;
130 bool mAutoSave; 130 bool mAutoSave;
131 int mAutoSaveInterval; 131 int mAutoSaveInterval;
132 bool mConfirm; 132 bool mConfirm;
133 133
134 bool mEnableGroupScheduling; 134 bool mEnableGroupScheduling;
135 bool mEnableProjectView; 135 bool mEnableProjectView;
136 136
137 int mDefaultFormat; 137 int mDefaultFormat;
138 int mMailClient; 138 int mMailClient;
139 139
140 int mStartTime; 140 int mStartTime;
141 int mDefaultDuration; 141 int mDefaultDuration;
142 int mAlarmTime; 142 int mAlarmTime;
143 143
144 int mWorkingHoursStart; 144 int mWorkingHoursStart;
145 int mWorkingHoursEnd; 145 int mWorkingHoursEnd;
146 bool mExcludeHolidays; 146 bool mExcludeHolidays;
147 bool mExcludeSaturdays; 147 bool mExcludeSaturdays;
148 bool mMarcusBainsShowSeconds; 148 bool mMarcusBainsShowSeconds;
149 149
150 QFont mTimeBarFont; 150 QFont mTimeBarFont;
151 QFont mMonthViewFont; 151 QFont mMonthViewFont;
152 QFont mAgendaViewFont; 152 QFont mAgendaViewFont;
153 QFont mMarcusBainsFont; 153 QFont mMarcusBainsFont;
154 QFont mTimeLabelsFont; 154 QFont mTimeLabelsFont;
155 QFont mTodoViewFont; 155 QFont mTodoViewFont;
156 QFont mListViewFont; 156 QFont mListViewFont;
157 QFont mDateNavigatorFont; 157 QFont mDateNavigatorFont;
158 QFont mEditBoxFont; 158 QFont mEditBoxFont;
159 QFont mJornalViewFont; 159 QFont mJornalViewFont;
160 QFont mWhatsNextFont; 160 QFont mWhatsNextFont;
161 QFont mEventViewFont; 161 QFont mEventViewFont;
162 162
163 163
164 164
165 165
166 QColor mHolidayColor; 166 QColor mHolidayColor;
167 QColor mHighlightColor; 167 QColor mHighlightColor;
168 QColor mEventColor; 168 QColor mEventColor;
169 QColor mTodoDoneColor; 169 QColor mTodoDoneColor;
170 QColor mAgendaBgColor; 170 QColor mAgendaBgColor;
171 QColor mWorkingHoursColor; 171 QColor mWorkingHoursColor;
172 QColor mTodoDueTodayColor; 172 QColor mTodoDueTodayColor;
173 QColor mTodoOverdueColor; 173 QColor mTodoOverdueColor;
174 QColor mTodoRunColor; 174 QColor mTodoRunColor;
175 QColor mMonthViewEvenColor; 175 QColor mMonthViewEvenColor;
176 QColor mMonthViewOddColor; 176 QColor mMonthViewOddColor;
177 QColor mMonthViewHolidayColor; 177 QColor mMonthViewHolidayColor;
178 bool mMonthViewUsesDayColors; 178 bool mMonthViewUsesDayColors;
179 bool mMonthViewSatSunTog; 179 bool mMonthViewSatSunTog;
180 bool mMonthViewWeek; 180 bool mMonthViewWeek;
181 QColor mAppColor1; 181 QColor mAppColor1;
182 QColor mAppColor2; 182 QColor mAppColor2;
183 bool mUseAppColors; 183 bool mUseAppColors;
184 184
185 int mDayBegins; 185 int mDayBegins;
186 int mHourSize; 186 int mHourSize;
187 int mAllDaySize; 187 int mAllDaySize;
188 bool mShowFullMenu; 188 bool mShowFullMenu;
189 bool mDailyRecur; 189 bool mDailyRecur;
190 bool mWeeklyRecur; 190 bool mWeeklyRecur;
191 bool mMonthDailyRecur; 191 bool mMonthDailyRecur;
192 bool mMonthWeeklyRecur; 192 bool mMonthWeeklyRecur;
193 bool mMonthShowIcons; 193 bool mMonthShowIcons;
194 bool mMonthShowTimes; 194 bool mMonthShowTimes;
195 bool mMonthShowShort; 195 bool mMonthShowShort;
196 bool mEnableToolTips; 196 bool mEnableToolTips;
197 bool mEnableMonthScroll; 197 bool mEnableMonthScroll;
198 bool mFullViewMonth; 198 bool mFullViewMonth;
199 bool mMonthViewUsesCategoryColor; 199 bool mMonthViewUsesCategoryColor;
200 bool mFullViewTodo; 200 bool mFullViewTodo;
201 bool mShowCompletedTodo; 201 bool mShowCompletedTodo;
202 bool mMarcusBainsEnabled; 202 bool mMarcusBainsEnabled;
203 int mNextXDays; 203 int mNextXDays;
204 int mWhatsNextDays; 204 int mWhatsNextDays;
205 int mWhatsNextPrios; 205 int mWhatsNextPrios;
206 bool mEnableQuickTodo; 206 bool mEnableQuickTodo;
207 207
208 bool mCompactDialogs; 208 bool mCompactDialogs;
209 bool mVerticalScreen; 209 bool mVerticalScreen;
210 210
211 bool mShowIconNewTodo; 211 bool mShowIconNewTodo;
212 bool mShowIconNewEvent; 212 bool mShowIconNewEvent;
213 bool mShowIconSearch; 213 bool mShowIconSearch;
214 bool mShowIconList; 214 bool mShowIconList;
215 bool mShowIconDay1; 215 bool mShowIconDay1;
216 bool mShowIconDay5; 216 bool mShowIconDay5;
217 bool mShowIconDay6; 217 bool mShowIconDay6;
218 bool mShowIconDay7; 218 bool mShowIconDay7;
219 bool mShowIconMonth; 219 bool mShowIconMonth;
220 bool mShowIconTodoview; 220 bool mShowIconTodoview;
221 bool mShowIconBackFast; 221 bool mShowIconBackFast;
222 bool mShowIconBack; 222 bool mShowIconBack;
223 bool mShowIconToday; 223 bool mShowIconToday;
224 bool mShowIconForward; 224 bool mShowIconForward;
225 bool mShowIconForwardFast; 225 bool mShowIconForwardFast;
226 bool mShowIconWhatsThis; 226 bool mShowIconWhatsThis;
227 bool mShowIconWeekNum; 227 bool mShowIconWeekNum;
228 bool mShowIconNextDays; 228 bool mShowIconNextDays;
229 bool mShowIconNext; 229 bool mShowIconNext;
230 bool mShowIconJournal; 230 bool mShowIconJournal;
231 bool mShowIconFilter; 231 bool mShowIconFilter;
232 bool mShowIconOnetoolbar; 232 bool mShowIconOnetoolbar;
233 bool mShowIconNavigator; 233 bool mShowIconNavigator;
234 bool mShowIconAllday; 234 bool mShowIconAllday;
235 bool mShowIconFilterview; 235 bool mShowIconFilterview;
236 bool mShowIconToggleFull; 236 bool mShowIconToggleFull;
237 237
238 bool mShowIconStretch; 238 bool mShowIconStretch;
239 239
240 bool mToolBarHor; 240 bool mToolBarHor;
241 bool mToolBarUp; 241 bool mToolBarUp;
242 bool mToolBarHorV; 242 bool mToolBarHorV;
243 bool mToolBarUpV; 243 bool mToolBarUpV;
244 bool mToolBarHorN; 244 bool mToolBarHorN;
245 bool mToolBarUpN; 245 bool mToolBarUpN;
246 bool mToolBarHorF; 246 bool mToolBarHorF;
247 bool mToolBarUpF; 247 bool mToolBarUpF;
248 bool mToolBarMiniIcons; 248 bool mToolBarMiniIcons;
249 249
250 bool mAskForQuit; 250 bool mAskForQuit;
251 bool mUsePassWd; 251 bool mUsePassWd;
252 bool mShowSyncEvents; 252 bool mShowSyncEvents;
253 bool mShowTodoInAgenda; 253 bool mShowTodoInAgenda;
254 bool mShowCompletedTodoInAgenda; 254 bool mShowCompletedTodoInAgenda;
255 bool mShowTimeInAgenda; 255 bool mShowTimeInAgenda;
256 bool mHideNonStartedTodos; 256 bool mHideNonStartedTodos;
257 257
258 bool mBlockPopupMenu; 258 bool mBlockPopupMenu;
259 259
260 int mLastSyncTime; 260 int mLastSyncTime;
261 void setCategoryColor(QString cat,const QColor & color); 261 void setCategoryColor(QString cat,const QColor & color);
262 QColor *categoryColor(QString cat); 262 QColor *categoryColor(QString cat);
263 263
264 QString mArchiveFile; 264 QString mArchiveFile;
265 QString mHtmlExportFile; 265 QString mHtmlExportFile;
266 bool mHtmlWithSave; 266 bool mHtmlWithSave;
267 267
268 QStringList mSelectedPlugins; 268 QStringList mSelectedPlugins;
269 269
270 QString mLastImportFile; 270 QString mLastImportFile;
271 QString mLastVcalFile; 271 QString mLastVcalFile;
272 QString mLastSaveFile; 272 QString mLastSaveFile;
273 QString mLastLoadFile; 273 QString mLastLoadFile;
274 274
275 275
276 QString mDefaultAlarmFile; 276 QString mDefaultAlarmFile;
277 int mIMIPScheduler; 277 int mIMIPScheduler;
278 int mIMIPSend; 278 int mIMIPSend;
279 QStringList mAdditionalMails; 279 QStringList mAdditionalMails;
280 int mIMIPAutoRefresh; 280 int mIMIPAutoRefresh;
281 int mIMIPAutoInsertReply; 281 int mIMIPAutoInsertReply;
282 int mIMIPAutoInsertRequest; 282 int mIMIPAutoInsertRequest;
283 int mIMIPAutoFreeBusy; 283 int mIMIPAutoFreeBusy;
284 int mIMIPAutoFreeBusyReply; 284 int mIMIPAutoFreeBusyReply;
285 285
286 QStringList mTodoTemplates; 286 QStringList mTodoTemplates;
287 QStringList mEventTemplates; 287 QStringList mEventTemplates;
288 288
289 int mDestination; 289 int mDestination;
290 290
291 291
292 bool mEditOnDoubleClick; 292 bool mEditOnDoubleClick;
293 bool mViewChangeHoldFullscreen; 293 bool mViewChangeHoldFullscreen;
294 bool mViewChangeHoldNonFullscreen; 294 bool mViewChangeHoldNonFullscreen;
295 bool mCenterOnCurrentTime; 295 bool mCenterOnCurrentTime;
296 bool mSetTimeToDayStartAt; 296 bool mSetTimeToDayStartAt;
297 bool mHighlightCurrentDay; 297 bool mHighlightCurrentDay;
298 bool mUseHighlightLightColor; 298 bool mUseHighlightLightColor;
299 bool mListViewMonthTimespan; 299 bool mListViewMonthTimespan;
300 bool mWNViewShowsParents; 300 bool mWNViewShowsParents;
301 bool mWNViewShowsPast; 301 bool mWNViewShowsPast;
302 bool mWNViewShowLocation; 302 bool mWNViewShowLocation;
303 bool mTodoViewShowsPercentage; 303 bool mTodoViewShowsPercentage;
304 bool mTodoViewUsesCatColors; 304 bool mTodoViewUsesCatColors;
305 bool mMonthViewUsesBigFont; 305 bool mMonthViewUsesBigFont;
306 bool mTodoViewUsesSmallFont; 306 bool mTodoViewUsesSmallFont;
307 bool mTodoViewUsesForegroundColor; 307 bool mTodoViewUsesForegroundColor;
308 bool mMonthViewUsesForegroundColor; 308 bool mMonthViewUsesForegroundColor;
309 309
310 bool mHightlightDateTimeEdit; 310 bool mHightlightDateTimeEdit;
311 bool mShortDateInViewer; 311 bool mShortDateInViewer;
312 312
313 bool mShowDateNavigator; 313 bool mShowDateNavigator;
314 314
315 QStringList mLocationDefaults; 315 QStringList mLocationDefaults;
316 QStringList mEventSummaryUser; 316 QStringList mEventSummaryUser;
317 QStringList mTodoSummaryUser; 317 QStringList mTodoSummaryUser;
318 QStringList mJournalSummaryUser;
318 319
319 bool mUseInternalAlarmNotification; 320 bool mUseInternalAlarmNotification;
320 int mAlarmPlayBeeps; 321 int mAlarmPlayBeeps;
321 int mAlarmSuspendTime; 322 int mAlarmSuspendTime;
322 int mAlarmSuspendCount; 323 int mAlarmSuspendCount;
323 int mAlarmBeepInterval; 324 int mAlarmBeepInterval;
324 int mOldLanguage; 325 int mOldLanguage;
325 int mOldLoadedLanguage; 326 int mOldLoadedLanguage;
326 327
327 328
328 QString mActiveSyncPort; 329 QString mActiveSyncPort;
329 QString mActiveSyncIP; 330 QString mActiveSyncIP;
330 331
331 // settings for eventviewer 332 // settings for eventviewer
332 bool mEVshowDetails; 333 bool mEVshowDetails;
333 bool mEVshowCreated; 334 bool mEVshowCreated;
334 bool mEVshowChanged; 335 bool mEVshowChanged;
335 bool mWTshowDetails; 336 bool mWTshowDetails;
336 bool mWTshowCreated; 337 bool mWTshowCreated;
337 bool mWTshowChanged; 338 bool mWTshowChanged;
338 339
339 int mCurrentDisplayedView; 340 int mCurrentDisplayedView;
340 QPtrList<KopiCalendarFile> mCalendars; 341 QPtrList<KopiCalendarFile> mCalendars;
341 int mNextAvailableCalendar; 342 int mNextAvailableCalendar;
342 343
343 private: 344 private:
344 QDict<QColor> mCategoryColors; 345 QDict<QColor> mCategoryColors;
345 QArray<KopiCalendarFile*> mDefCalColors; 346 QArray<KopiCalendarFile*> mDefCalColors;
346 QColor mDefaultCategoryColor; 347 QColor mDefaultCategoryColor;
347 348
348 QFont mDefaultTimeBarFont; 349 QFont mDefaultTimeBarFont;
349 QFont mDefaultViewFont; 350 QFont mDefaultViewFont;
350 QFont mDefaultMonthViewFont; 351 QFont mDefaultMonthViewFont;
351 352
352 QString mName; 353 QString mName;
353 QString mEmail; 354 QString mEmail;
354}; 355};
355 356
356#endif 357#endif