summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp13
-rw-r--r--korganizer/koeditorgeneral.h3
-rw-r--r--korganizer/koeventeditor.cpp1
3 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index abc80d4..f54660f 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,212 +1,217 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qfile.h> 32#include <qfile.h>
33 33
34 34
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#include <kfiledialog.h> 40#include <kfiledialog.h>
41#include <kstandarddirs.h> 41#include <kstandarddirs.h>
42 42
43#include <libkcal/todo.h> 43#include <libkcal/todo.h>
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "koglobals.h" 49#include "koglobals.h"
50 50
51#include "koeditorgeneral.h" 51#include "koeditorgeneral.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#else 55#else
56#include <qapplication.h> 56#include <qapplication.h>
57#endif 57#endif
58 58
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 60 QObject( parent, name)
61{ 61{
62 mNextFocus = 0;
62} 63}
63 64
64KOEditorGeneral::~KOEditorGeneral() 65KOEditorGeneral::~KOEditorGeneral()
65{ 66{
66} 67}
67 68
68void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 69void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
69{ 70{
70 QGridLayout *headerLayout = new QGridLayout(topLayout); 71 QGridLayout *headerLayout = new QGridLayout(topLayout);
71 72
72#if 0 73#if 0
73 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 74 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
74 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 75 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
75#endif 76#endif
76 77
77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 78 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
78 headerLayout->addWidget(summaryLabel,1,0); 79 headerLayout->addWidget(summaryLabel,1,0);
79 80
80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 81 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 82 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 83 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 84 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 85 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
85 if ( QApplication::desktop()->width() > 320 ) 86 if ( QApplication::desktop()->width() > 320 )
86 mSummaryEdit->setMaximumHeight( hei +6 ); 87 mSummaryEdit->setMaximumHeight( hei +6 );
87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 88 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 89 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
89 // mSummaryEdit = new QLineEdit(parent); 90 // mSummaryEdit = new QLineEdit(parent);
90 headerLayout->addWidget(mSummaryEdit,1,1); 91 headerLayout->addWidget(mSummaryEdit,1,1);
91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 92 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
92 93
93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 94 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
94 headerLayout->addWidget(locationLabel,2,0); 95 headerLayout->addWidget(locationLabel,2,0);
95 96
96 mLocationEdit = new KOLocationBox(TRUE,parent,10); 97 mLocationEdit = new KOLocationBox(TRUE,parent,10);
97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 98 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
98 if ( QApplication::desktop()->width() > 320 ) 99 if ( QApplication::desktop()->width() > 320 )
99 mLocationEdit->setMaximumHeight( hei + 6); 100 mLocationEdit->setMaximumHeight( hei + 6);
100 101
101 // mLocationEdit = new QLineEdit(parent); 102 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 103 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 104 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 105 headerLayout->setColStretch( 1, 10);
105} 106}
106void KOEditorGeneral::setFocusOn( int i ) 107void KOEditorGeneral::setFocusOn( int i )
107{ 108{
108 qApp->processEvents(); 109 mNextFocus = i;
109 if ( i == 1 ) { 110 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
111}
112void KOEditorGeneral::slotSetFocusOn()
113{
114 mNextFocus;
115 if ( mNextFocus == 1 ) {
110 mDescriptionEdit->setFocus(); 116 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 117 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 118 }
113 if ( i == 2 ) { 119 if ( mNextFocus == 2 ) {
114 mSummaryEdit->setFocus(); 120 mSummaryEdit->setFocus();
115 } 121 }
116
117} 122}
118void KOEditorGeneral::editCategories() 123void KOEditorGeneral::editCategories()
119{ 124{
120 // qDebug("KOEditorGeneral::editCategories() "); 125 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 126 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 127 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 128 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled(); 129 csd->setColorEnabled();
125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 130 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
126 csd->exec(); 131 csd->exec();
127 delete csd; 132 delete csd;
128} 133}
129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 134void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
130{ 135{
131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 136 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
132 137
133 mCategoriesButton = new QPushButton(parent); 138 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 139 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 140 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 141 categoriesLayout->addWidget(mCategoriesButton);
137 142
138 mCategoriesLabel = new QLabel(parent); 143 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 144 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 145 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 146}
142 147
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 148void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 149{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 150 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 151
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 152 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 153 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 154 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 155 secrecyLayout->addWidget(secrecyLabel);
151 156
152 mSecrecyCombo = new QComboBox(parent); 157 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 158 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 159 secrecyLayout->addWidget(mSecrecyCombo);
155} 160}
156 161
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 162void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 163{
159 mDescriptionEdit = new KTextEdit(parent); 164 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 165 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 166 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 167 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 168 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 169 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 170 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 172 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 173#endif
169 174
170} 175}
171 176
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 177void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 178{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 179 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 180
176 //mAlarmBell = new QLabel(parent); 181 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 182 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 183 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 184 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 185 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 186 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 187 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 188
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 189 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 190 alarmLayout->addWidget(mAlarmButton);
186 191
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 192 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 193 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
189 alarmLayout->addWidget(mAlarmTimeEdit); 194 alarmLayout->addWidget(mAlarmTimeEdit);
190 mAlarmIncrCombo = new QComboBox(false, parent); 195 mAlarmIncrCombo = new QComboBox(false, parent);
191 if ( QApplication::desktop()->width() < 320 ) { 196 if ( QApplication::desktop()->width() < 320 ) {
192 mAlarmIncrCombo->insertItem(i18n("min")); 197 mAlarmIncrCombo->insertItem(i18n("min"));
193 mAlarmIncrCombo->insertItem(i18n("hou")); 198 mAlarmIncrCombo->insertItem(i18n("hou"));
194 mAlarmIncrCombo->insertItem(i18n("day")); 199 mAlarmIncrCombo->insertItem(i18n("day"));
195 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 200 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
196 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 201 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
197 } else { 202 } else {
198 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 203 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
199 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 204 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
200 mAlarmIncrCombo->insertItem(i18n("day(s)")); 205 mAlarmIncrCombo->insertItem(i18n("day(s)"));
201 } 206 }
202 207
203 // mAlarmIncrCombo->setMinimumHeight(20); 208 // mAlarmIncrCombo->setMinimumHeight(20);
204 alarmLayout->addWidget(mAlarmIncrCombo); 209 alarmLayout->addWidget(mAlarmIncrCombo);
205 mAlarmSoundButton = new QPushButton(parent); 210 mAlarmSoundButton = new QPushButton(parent);
206 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 211 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
207 mAlarmSoundButton->setToggleButton(true); 212 mAlarmSoundButton->setToggleButton(true);
208 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 213 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
209 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 214 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
210 alarmLayout->addWidget(mAlarmSoundButton); 215 alarmLayout->addWidget(mAlarmSoundButton);
211 216
212 mAlarmProgramButton = new QPushButton(parent); 217 mAlarmProgramButton = new QPushButton(parent);
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index f4728c7..2069e9c 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -1,114 +1,115 @@
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 KOEDITORGENERAL_H 23#ifndef KOEDITORGENERAL_H
24#define KOEDITORGENERAL_H 24#define KOEDITORGENERAL_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <qgroupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qlistview.h> 33#include <qlistview.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37 37
38#include <ktextedit.h> 38#include <ktextedit.h>
39#include <krestrictedline.h> 39#include <krestrictedline.h>
40 40
41#include <libkcal/incidence.h> 41#include <libkcal/incidence.h>
42 42
43#include "ktimeedit.h" 43#include "ktimeedit.h"
44 44
45class KDateEdit; 45class KDateEdit;
46class KOLocationBox; 46class KOLocationBox;
47using namespace KCal; 47using namespace KCal;
48 48
49class KOEditorGeneral : public QObject 49class KOEditorGeneral : public QObject
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 public: 52 public:
53 KOEditorGeneral (QObject* parent=0,const char* name=0); 53 KOEditorGeneral (QObject* parent=0,const char* name=0);
54 virtual ~KOEditorGeneral(); 54 virtual ~KOEditorGeneral();
55 void setFocusOn( int i ); 55 void setFocusOn( int i );
56 void initHeader(QWidget *,QBoxLayout *); 56 void initHeader(QWidget *,QBoxLayout *);
57 void initDescription(QWidget *,QBoxLayout *); 57 void initDescription(QWidget *,QBoxLayout *);
58 void initSecrecy(QWidget *,QBoxLayout *); 58 void initSecrecy(QWidget *,QBoxLayout *);
59 void initCategories(QWidget *,QBoxLayout *); 59 void initCategories(QWidget *,QBoxLayout *);
60 void initAlarm(QWidget *,QBoxLayout *); 60 void initAlarm(QWidget *,QBoxLayout *);
61 61
62 /** Set widgets to default values */ 62 /** Set widgets to default values */
63 void setDefaults(bool allDay); 63 void setDefaults(bool allDay);
64 /** Read event object and setup widgets accordingly */ 64 /** Read event object and setup widgets accordingly */
65 void readIncidence(Incidence *); 65 void readIncidence(Incidence *);
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeIncidence(Incidence *); 67 void writeIncidence(Incidence *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput() { return true; } 70 bool validateInput() { return true; }
71 71
72 void enableAlarm( bool enable ); 72 void enableAlarm( bool enable );
73 void setSecrecy( int num ); 73 void setSecrecy( int num );
74 public slots: 74 public slots:
75 void setCategories(const QString &); 75 void setCategories(const QString &);
76 void editCategories(); 76 void editCategories();
77 77
78 protected slots: 78 protected slots:
79 void enableAlarmEdit( bool enable ); 79 void enableAlarmEdit( bool enable );
80 void disableAlarmEdit( bool disable ); 80 void disableAlarmEdit( bool disable );
81 void alarmDisable( bool disable ); 81 void alarmDisable( bool disable );
82 void pickAlarmSound(); 82 void pickAlarmSound();
83 void pickAlarmProgram(); 83 void pickAlarmProgram();
84 84 void slotSetFocusOn();
85 signals: 85 signals:
86 void openCategoryDialog(); 86 void openCategoryDialog();
87 void allAccepted(); 87 void allAccepted();
88 88
89 protected: 89 protected:
90 int mNextFocus;
90 //QLineEdit *mSummaryEdit; 91 //QLineEdit *mSummaryEdit;
91 //QLineEdit *mLocationEdit; 92 //QLineEdit *mLocationEdit;
92 KOLocationBox *mSummaryEdit; 93 KOLocationBox *mSummaryEdit;
93 KOLocationBox *mLocationEdit; 94 KOLocationBox *mLocationEdit;
94 QLabel *mAlarmBell; 95 QLabel *mAlarmBell;
95 QCheckBox *mAlarmButton; 96 QCheckBox *mAlarmButton;
96 QSpinBox *mAlarmTimeEdit; 97 QSpinBox *mAlarmTimeEdit;
97 QPushButton *mAlarmSoundButton; 98 QPushButton *mAlarmSoundButton;
98 QPushButton *mAlarmProgramButton; 99 QPushButton *mAlarmProgramButton;
99 QComboBox *mAlarmIncrCombo; 100 QComboBox *mAlarmIncrCombo;
100 KTextEdit *mDescriptionEdit; 101 KTextEdit *mDescriptionEdit;
101 QLabel *mOwnerLabel; 102 QLabel *mOwnerLabel;
102 QComboBox *mSecrecyCombo; 103 QComboBox *mSecrecyCombo;
103 QCheckBox *mCancelBox; 104 QCheckBox *mCancelBox;
104 QPushButton *mCategoriesButton; 105 QPushButton *mCategoriesButton;
105 QLabel *mCategoriesLabel; 106 QLabel *mCategoriesLabel;
106 107
107 private: 108 private:
108 QString getFittingPath( const QString ) ; 109 QString getFittingPath( const QString ) ;
109 QString mAlarmSound; 110 QString mAlarmSound;
110 QString mAlarmProgram; 111 QString mAlarmProgram;
111 QString mAlarmMessage; 112 QString mAlarmMessage;
112}; 113};
113 114
114#endif 115#endif
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 337db9b..e23e680 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -93,193 +93,192 @@ void KOEventEditor::setSecrecy( int sec )
93} 93}
94void KOEventEditor::setCategories( QString s ) 94void KOEventEditor::setCategories( QString s )
95{ 95{
96 mGeneral->setCategories(s); 96 mGeneral->setCategories(s);
97 97
98} 98}
99void KOEventEditor::setupGeneral() 99void KOEventEditor::setupGeneral()
100{ 100{
101 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 101 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
103 103
104 if( KOPrefs::instance()->mCompactDialogs ) { 104 if( KOPrefs::instance()->mCompactDialogs ) {
105 QFrame *topFrame = addPage(i18n("General")); 105 QFrame *topFrame = addPage(i18n("General"));
106 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 106 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
107 topLayout->setSpacing(spacingHint()-1); 107 topLayout->setSpacing(spacingHint()-1);
108 topLayout->setMargin(marginHint()-1); 108 topLayout->setMargin(marginHint()-1);
109 mGeneral->initHeader(topFrame,topLayout); 109 mGeneral->initHeader(topFrame,topLayout);
110 mGeneral->initTime(topFrame,topLayout); 110 mGeneral->initTime(topFrame,topLayout);
111// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 111// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
112 mGeneral->initAlarm(topFrame,topLayout); 112 mGeneral->initAlarm(topFrame,topLayout);
113 mGeneral->enableAlarm( false ); 113 mGeneral->enableAlarm( false );
114 114
115 QBoxLayout *buttonLayout; 115 QBoxLayout *buttonLayout;
116 if ( QApplication::desktop()->width() < 500 ) 116 if ( QApplication::desktop()->width() < 500 )
117 buttonLayout = new QVBoxLayout( topLayout ); 117 buttonLayout = new QVBoxLayout( topLayout );
118 else 118 else
119 buttonLayout = new QHBoxLayout( topLayout ); 119 buttonLayout = new QHBoxLayout( topLayout );
120 QHBox* buttonWidget = new QHBox (topFrame); 120 QHBox* buttonWidget = new QHBox (topFrame);
121 QIconSet icon; 121 QIconSet icon;
122 if ( QApplication::desktop()->width() < 321 ) 122 if ( QApplication::desktop()->width() < 321 )
123 icon = SmallIcon("fileexport16"); 123 icon = SmallIcon("fileexport16");
124 else 124 else
125 icon = SmallIcon("fileexport"); 125 icon = SmallIcon("fileexport");
126 QPushButton * loadTemplate = new QPushButton( buttonWidget); 126 QPushButton * loadTemplate = new QPushButton( buttonWidget);
127 QPushButton * saveTemplate = new QPushButton( buttonWidget); 127 QPushButton * saveTemplate = new QPushButton( buttonWidget);
128 saveTemplate->setIconSet (icon ) ; 128 saveTemplate->setIconSet (icon ) ;
129 int size = saveTemplate->sizeHint().height(); 129 int size = saveTemplate->sizeHint().height();
130 saveTemplate->setFixedSize( size, size ); 130 saveTemplate->setFixedSize( size, size );
131 if ( QApplication::desktop()->width() < 321 ) 131 if ( QApplication::desktop()->width() < 321 )
132 icon = SmallIcon("fileimport16"); 132 icon = SmallIcon("fileimport16");
133 else 133 else
134 icon = SmallIcon("fileimport"); 134 icon = SmallIcon("fileimport");
135 loadTemplate->setIconSet (icon ) ; 135 loadTemplate->setIconSet (icon ) ;
136 loadTemplate->setFixedSize( size, size ); 136 loadTemplate->setFixedSize( size, size );
137 buttonLayout->addWidget( buttonWidget ); 137 buttonLayout->addWidget( buttonWidget );
138 mGeneral->initCategories( topFrame, buttonLayout ); 138 mGeneral->initCategories( topFrame, buttonLayout );
139 139
140 topLayout->addStretch( 1 ); 140 topLayout->addStretch( 1 );
141 141
142 QFrame *topFrame2 = addPage(i18n("Details")); 142 QFrame *topFrame2 = addPage(i18n("Details"));
143 143
144 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 144 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
145 topLayout2->setSpacing(spacingHint()); 145 topLayout2->setSpacing(spacingHint());
146 146
147 mGeneral->initClass(topFrame2,topLayout2); 147 mGeneral->initClass(topFrame2,topLayout2);
148 mGeneral->initSecrecy( topFrame2, topLayout2 ); 148 mGeneral->initSecrecy( topFrame2, topLayout2 );
149 mGeneral->initDescription(topFrame2,topLayout2); 149 mGeneral->initDescription(topFrame2,topLayout2);
150 150
151 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 151 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
152 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 152 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
153 } else { 153 } else {
154 QFrame *topFrame = addPage(i18n("General")); 154 QFrame *topFrame = addPage(i18n("General"));
155 155
156 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 156 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
157 topLayout->setSpacing(spacingHint()); 157 topLayout->setSpacing(spacingHint());
158 158
159 mGeneral->initHeader(topFrame,topLayout); 159 mGeneral->initHeader(topFrame,topLayout);
160 mGeneral->initTime(topFrame,topLayout); 160 mGeneral->initTime(topFrame,topLayout);
161 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 161 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
162 mGeneral->initAlarm(topFrame,alarmLineLayout); 162 mGeneral->initAlarm(topFrame,alarmLineLayout);
163 mGeneral->initClass(topFrame,alarmLineLayout); 163 mGeneral->initClass(topFrame,alarmLineLayout);
164 mGeneral->initDescription(topFrame,topLayout); 164 mGeneral->initDescription(topFrame,topLayout);
165 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 165 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
166 mGeneral->initCategories( topFrame, detailsLayout ); 166 mGeneral->initCategories( topFrame, detailsLayout );
167 mGeneral->initSecrecy( topFrame, detailsLayout ); 167 mGeneral->initSecrecy( topFrame, detailsLayout );
168 } 168 }
169 169
170 mGeneral->finishSetup(); 170 mGeneral->finishSetup();
171 171
172} 172}
173 173
174void KOEventEditor::setupRecurrence() 174void KOEventEditor::setupRecurrence()
175{ 175{
176 QFrame *topFrame = addPage( i18n("Recurrence") ); 176 QFrame *topFrame = addPage( i18n("Recurrence") );
177 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 177 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
178 178
179 mRecurrence = new KOEditorRecurrence( topFrame ); 179 mRecurrence = new KOEditorRecurrence( topFrame );
180 topLayout->addWidget( mRecurrence ); 180 topLayout->addWidget( mRecurrence );
181} 181}
182 182
183void KOEventEditor::editEvent(Event *event, bool showDescription) 183void KOEventEditor::editEvent(Event *event, bool showDescription)
184{ 184{
185 // init(); 185 // init();
186 186
187 mEvent = event; 187 mEvent = event;
188 readEvent(mEvent); 188 readEvent(mEvent);
189 qApp->processEvents();
190 if ( showDescription ) { 189 if ( showDescription ) {
191 showPage( 1 ); 190 showPage( 1 );
192 mGeneral->setFocusOn( 1 ); 191 mGeneral->setFocusOn( 1 );
193 } else { 192 } else {
194 showPage( 0 ); 193 showPage( 0 );
195 mGeneral->setFocusOn( 2 ); 194 mGeneral->setFocusOn( 2 );
196 } 195 }
197} 196}
198 197
199void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) 198void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
200{ 199{
201 // init(); 200 // init();
202 201
203 mEvent = 0; 202 mEvent = 0;
204 setDefaults(from,to,allDay); 203 setDefaults(from,to,allDay);
205} 204}
206 205
207void KOEventEditor::loadDefaults() 206void KOEventEditor::loadDefaults()
208{ 207{
209 int fmt = KOPrefs::instance()->mStartTime; 208 int fmt = KOPrefs::instance()->mStartTime;
210 209
211 QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); 210 QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
212 QDateTime to(QDate::currentDate(), 211 QDateTime to(QDate::currentDate(),
213 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); 212 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));
214 213
215 setDefaults(from,to,false); 214 setDefaults(from,to,false);
216} 215}
217 216
218bool KOEventEditor::processInput( bool emitTime ) 217bool KOEventEditor::processInput( bool emitTime )
219{ 218{
220 if (!validateInput()) return false; 219 if (!validateInput()) return false;
221 220
222 Event *event = 0; 221 Event *event = 0;
223 222
224 if (mEvent) event = mEvent; 223 if (mEvent) event = mEvent;
225 else { 224 else {
226 event = new Event; 225 event = new Event;
227 event->setOrganizer(KOPrefs::instance()->email()); 226 event->setOrganizer(KOPrefs::instance()->email());
228 } 227 }
229 228
230 writeEvent(event); 229 writeEvent(event);
231 if ( emitTime ) { 230 if ( emitTime ) {
232 globalFlagBlockAgenda = 1; 231 globalFlagBlockAgenda = 1;
233 emit showAgendaView( false ); 232 emit showAgendaView( false );
234 emit jumpToTime( event->dtStart().date() ); 233 emit jumpToTime( event->dtStart().date() );
235 globalFlagBlockAgenda = 2; 234 globalFlagBlockAgenda = 2;
236 235
237 } 236 }
238 if (mEvent) { 237 if (mEvent) {
239 event->setRevision(event->revision()+1); 238 event->setRevision(event->revision()+1);
240 emit eventChanged(event); 239 emit eventChanged(event);
241 } else { 240 } else {
242 mCalendar->addEvent(event); 241 mCalendar->addEvent(event);
243 mEvent = event; 242 mEvent = event;
244 emit eventAdded(event); 243 emit eventAdded(event);
245 } 244 }
246 245
247 return true; 246 return true;
248} 247}
249 248
250void KOEventEditor::deleteEvent() 249void KOEventEditor::deleteEvent()
251{ 250{
252 kdDebug() << "Delete event" << endl; 251 kdDebug() << "Delete event" << endl;
253 252
254 if (mEvent) { 253 if (mEvent) {
255 if (KOPrefs::instance()->mConfirm) { 254 if (KOPrefs::instance()->mConfirm) {
256 switch (msgItemDelete()) { 255 switch (msgItemDelete()) {
257 case KMessageBox::Continue: // OK 256 case KMessageBox::Continue: // OK
258 emit eventToBeDeleted(mEvent); 257 emit eventToBeDeleted(mEvent);
259 emit dialogClose(mEvent); 258 emit dialogClose(mEvent);
260 mCalendar->deleteEvent(mEvent); 259 mCalendar->deleteEvent(mEvent);
261 emit eventDeleted(); 260 emit eventDeleted();
262 reject(); 261 reject();
263 break; 262 break;
264 } 263 }
265 } 264 }
266 else { 265 else {
267 emit eventToBeDeleted(mEvent); 266 emit eventToBeDeleted(mEvent);
268 emit dialogClose(mEvent); 267 emit dialogClose(mEvent);
269 mCalendar->deleteEvent(mEvent); 268 mCalendar->deleteEvent(mEvent);
270 emit eventDeleted(); 269 emit eventDeleted();
271 reject(); 270 reject();
272 } 271 }
273 } else { 272 } else {
274 reject(); 273 reject();
275 } 274 }
276} 275}
277 276
278void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay) 277void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
279{ 278{
280 mGeneral->setDefaults(from,to,allDay); 279 mGeneral->setDefaults(from,to,allDay);
281 mDetails->setDefaults(); 280 mDetails->setDefaults();
282 mRecurrence->setDefaults(from,to,allDay); 281 mRecurrence->setDefaults(from,to,allDay);
283 showPage( 0 ); 282 showPage( 0 );
284 mGeneral->setFocusOn( 2 ); 283 mGeneral->setFocusOn( 2 );
285} 284}