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
@@ -38,119 +38,119 @@
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()) );
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 6fa9b23..9b0e748 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -5,119 +5,119 @@
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();
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
@@ -86,96 +86,97 @@ KOPrefs::KOPrefs() :
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);
@@ -318,96 +319,97 @@ KOPrefs::KOPrefs() :
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 ;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 5cc9bfa..53d193b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -270,87 +270,88 @@ class KOPrefs : public KPimPrefs
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