summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp1
-rw-r--r--korganizer/koeditorgeneral.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index e545ca8..c9e307f 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,229 +1,230 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#include <qapplication.h>
38#define AGENDA_ICON_SIZE 7 39#define AGENDA_ICON_SIZE 7
39#endif 40#endif
40#include <libkcal/icaldrag.h> 41#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 42#include <libkcal/vcaldrag.h>
42#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 44extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 45extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 46extern int globalFlagBlockAgendaItemUpdate;
46 47
47#include "koprefs.h" 48#include "koprefs.h"
48 49
49#include "koagendaitem.h" 50#include "koagendaitem.h"
50//#include "koagendaitem.moc" 51//#include "koagendaitem.moc"
51 52
52 53
53//-------------------------------------------------------------------------- 54//--------------------------------------------------------------------------
54 55
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 57
57//-------------------------------------------------------------------------- 58//--------------------------------------------------------------------------
58 59
59class KOAgendaItemWhatsThis :public QWhatsThis 60class KOAgendaItemWhatsThis :public QWhatsThis
60{ 61{
61public: 62public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63 64
64protected: 65protected:
65 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
66 { 67 {
67 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
68 } 69 }
69private: 70private:
70 KOAgendaItem * _view; 71 KOAgendaItem * _view;
71}; 72};
72 73
73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
74 const char *name,WFlags) : 75 const char *name,WFlags) :
75 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
76{ 77{
77#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
78 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
79#endif 80#endif
80 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
82 setWFlags ( wflags); 83 setWFlags ( wflags);
83 mAllDay = allday; 84 mAllDay = allday;
84 init ( incidence, qd ); 85 init ( incidence, qd );
85 //setMouseTracking(true); 86 //setMouseTracking(true);
86 //setAcceptDrops(true); 87 //setAcceptDrops(true);
87 xPaintCoord = -1; 88 xPaintCoord = -1;
88 yPaintCoord = -1; 89 yPaintCoord = -1;
89} 90}
90QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
91{ 92{
92 if ( mIncidence ) 93 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 99}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 101{
101 mIncidence = incidence; 102 mIncidence = incidence;
102 mDate = qd; 103 mDate = qd;
103 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
104 mNextMultiItem = 0; 105 mNextMultiItem = 0;
105 mLastMultiItem = 0; 106 mLastMultiItem = 0;
106 computeText(); 107 computeText();
107 108
108 if ( (incidence->type() == "Todo") && 109 if ( (incidence->type() == "Todo") &&
109 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
113 else 114 else
114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
115 } 116 }
116 else { 117 else {
117 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
118 QString cat = categories.first(); 119 QString cat = categories.first();
119 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
122 else 123 else
123 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
124 } else { 125 } else {
125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
129 } 130 }
130 } 131 }
131 132
132 } 133 }
133 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
134 mBackgroundColor.dark(),mBackgroundColor.light(), 135 mBackgroundColor.dark(),mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 137 setBackgroundColor( mBackgroundColor );
137 138
138 mConflictItems.clear(); 139 mConflictItems.clear();
139 setCellXY(0,0,1); 140 setCellXY(0,0,1);
140 setCellXWidth(0); 141 setCellXWidth(0);
141 setSubCell(0); 142 setSubCell(0);
142 setSubCells(1); 143 setSubCells(1);
143 setMultiItem(0,0,0); 144 setMultiItem(0,0,0);
144 startMove(); 145 startMove();
145 mSelected = true; 146 mSelected = true;
146 select(false); 147 select(false);
147 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
148 mFontPixelSize = fontinf.height();; 149 mFontPixelSize = fontinf.height();;
149 hide(); 150 hide();
150 xPaintCoord = -1; 151 xPaintCoord = -1;
151 yPaintCoord = -1; 152 yPaintCoord = -1;
152} 153}
153 154
154 155
155KOAgendaItem::~KOAgendaItem() 156KOAgendaItem::~KOAgendaItem()
156{ 157{
157 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 158 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
158 // delete mKOAgendaItemWhatsThis; 159 // delete mKOAgendaItemWhatsThis;
159} 160}
160 161
161void KOAgendaItem::recreateIncidence() 162void KOAgendaItem::recreateIncidence()
162{ 163{
163#if 0 164#if 0
164 Incidence* newInc = mIncidence->clone(); 165 Incidence* newInc = mIncidence->clone();
165 newInc->recreate(); 166 newInc->recreate();
166 if ( mIncidence->doesRecur() ) { 167 if ( mIncidence->doesRecur() ) {
167 mIncidence->addExDate( mDate ); 168 mIncidence->addExDate( mDate );
168 newInc->recurrence()->unsetRecurs(); 169 newInc->recurrence()->unsetRecurs();
169 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 170 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
170 QTime tim = mIncidence->dtStart().time(); 171 QTime tim = mIncidence->dtStart().time();
171 newInc->setDtStart( QDateTime(mDate, tim) ); 172 newInc->setDtStart( QDateTime(mDate, tim) );
172 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 173 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
173 } 174 }
174#endif 175#endif
175 mIncidence = mIncidence->recreateCloneException( mDate ); 176 mIncidence = mIncidence->recreateCloneException( mDate );
176} 177}
177bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 178bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
178{ 179{
179 int size = AGENDA_ICON_SIZE; 180 int size = AGENDA_ICON_SIZE;
180 181
181 int yOff = 0; 182 int yOff = 0;
182 int xOff = 0; 183 int xOff = 0;
183 int x = pos().x() +3; 184 int x = pos().x() +3;
184 int y; 185 int y;
185 if ( mAllDay ) 186 if ( mAllDay )
186 y = pos().y()+3; 187 y = pos().y()+3;
187 else 188 else
188 y = mCellYTop * ( height() / cellHeight() ) +3; 189 y = mCellYTop * ( height() / cellHeight() ) +3;
189 if (mIncidence->cancelled()) { 190 if (mIncidence->cancelled()) {
190 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 191 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
191 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 192 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
192 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 193 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
193 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 194 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
194 if ( horLayout ) 195 if ( horLayout )
195 ++xOff; 196 ++xOff;
196 else 197 else
197 ++yOff; 198 ++yOff;
198 } 199 }
199 if (mIncidence->isAlarmEnabled()) { 200 if (mIncidence->isAlarmEnabled()) {
200 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 201 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
201 if ( horLayout ) 202 if ( horLayout )
202 ++xOff; 203 ++xOff;
203 else 204 else
204 ++yOff; 205 ++yOff;
205 } 206 }
206 if (mIncidence->recurrence()->doesRecur()) { 207 if (mIncidence->recurrence()->doesRecur()) {
207 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 208 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
208 if ( horLayout ) 209 if ( horLayout )
209 ++xOff; 210 ++xOff;
210 else 211 else
211 ++yOff; 212 ++yOff;
212 } 213 }
213 if (mIncidence->description().length() > 0) { 214 if (mIncidence->description().length() > 0) {
214 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 215 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
215 if ( horLayout ) 216 if ( horLayout )
216 ++xOff; 217 ++xOff;
217 else 218 else
218 ++yOff; 219 ++yOff;
219 } 220 }
220 if (mIncidence->isReadOnly()) { 221 if (mIncidence->isReadOnly()) {
221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 222 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
222 if ( horLayout ) 223 if ( horLayout )
223 ++xOff; 224 ++xOff;
224 else 225 else
225 ++yOff; 226 ++yOff;
226 } 227 }
227 228
228 if (mIncidence->attendeeCount()>0) { 229 if (mIncidence->attendeeCount()>0) {
229 230
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f54660f..9df76e7 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,223 +1,224 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h>
32#include <qfile.h> 33#include <qfile.h>
33 34
34 35
35#include <kglobal.h> 36#include <kglobal.h>
36#include <kdebug.h> 37#include <kdebug.h>
37#include <klocale.h> 38#include <klocale.h>
38#include <kiconloader.h> 39#include <kiconloader.h>
39#include <kmessagebox.h> 40#include <kmessagebox.h>
40#include <kfiledialog.h> 41#include <kfiledialog.h>
41#include <kstandarddirs.h> 42#include <kstandarddirs.h>
42 43
43#include <libkcal/todo.h> 44#include <libkcal/todo.h>
44#include <libkcal/event.h> 45#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 46#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
47 48
48#include "koprefs.h" 49#include "koprefs.h"
49#include "koglobals.h" 50#include "koglobals.h"
50 51
51#include "koeditorgeneral.h" 52#include "koeditorgeneral.h"
52#include "kolocationbox.h" 53#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
55#else 56#else
56#include <qapplication.h> 57#include <qapplication.h>
57#endif 58#endif
58 59
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 61 QObject( parent, name)
61{ 62{
62 mNextFocus = 0; 63 mNextFocus = 0;
63} 64}
64 65
65KOEditorGeneral::~KOEditorGeneral() 66KOEditorGeneral::~KOEditorGeneral()
66{ 67{
67} 68}
68 69
69void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 70void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
70{ 71{
71 QGridLayout *headerLayout = new QGridLayout(topLayout); 72 QGridLayout *headerLayout = new QGridLayout(topLayout);
72 73
73#if 0 74#if 0
74 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 75 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
75 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 76 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
76#endif 77#endif
77 78
78 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 79 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
79 headerLayout->addWidget(summaryLabel,1,0); 80 headerLayout->addWidget(summaryLabel,1,0);
80 81
81 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 82 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
82 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 83 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
83 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 84 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
84 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 85 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
85 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 86 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
86 if ( QApplication::desktop()->width() > 320 ) 87 if ( QApplication::desktop()->width() > 320 )
87 mSummaryEdit->setMaximumHeight( hei +6 ); 88 mSummaryEdit->setMaximumHeight( hei +6 );
88 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 89 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
89 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 90 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
90 // mSummaryEdit = new QLineEdit(parent); 91 // mSummaryEdit = new QLineEdit(parent);
91 headerLayout->addWidget(mSummaryEdit,1,1); 92 headerLayout->addWidget(mSummaryEdit,1,1);
92 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 93 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
93 94
94 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 95 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
95 headerLayout->addWidget(locationLabel,2,0); 96 headerLayout->addWidget(locationLabel,2,0);
96 97
97 mLocationEdit = new KOLocationBox(TRUE,parent,10); 98 mLocationEdit = new KOLocationBox(TRUE,parent,10);
98 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 99 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
99 if ( QApplication::desktop()->width() > 320 ) 100 if ( QApplication::desktop()->width() > 320 )
100 mLocationEdit->setMaximumHeight( hei + 6); 101 mLocationEdit->setMaximumHeight( hei + 6);
101 102
102 // mLocationEdit = new QLineEdit(parent); 103 // mLocationEdit = new QLineEdit(parent);
103 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 104 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
104 headerLayout->addWidget(mLocationEdit,2,1); 105 headerLayout->addWidget(mLocationEdit,2,1);
105 headerLayout->setColStretch( 1, 10); 106 headerLayout->setColStretch( 1, 10);
106} 107}
107void KOEditorGeneral::setFocusOn( int i ) 108void KOEditorGeneral::setFocusOn( int i )
108{ 109{
109 mNextFocus = i; 110 mNextFocus = i;
110 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 111 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
111} 112}
112void KOEditorGeneral::slotSetFocusOn() 113void KOEditorGeneral::slotSetFocusOn()
113{ 114{
114 mNextFocus; 115 mNextFocus;
115 if ( mNextFocus == 1 ) { 116 if ( mNextFocus == 1 ) {
116 mDescriptionEdit->setFocus(); 117 mDescriptionEdit->setFocus();
117 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 118 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
118 } 119 }
119 if ( mNextFocus == 2 ) { 120 if ( mNextFocus == 2 ) {
120 mSummaryEdit->setFocus(); 121 mSummaryEdit->setFocus();
121 } 122 }
122} 123}
123void KOEditorGeneral::editCategories() 124void KOEditorGeneral::editCategories()
124{ 125{
125 // qDebug("KOEditorGeneral::editCategories() "); 126 // qDebug("KOEditorGeneral::editCategories() ");
126 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 127 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
127 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 128 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
128 //KOGlobals::fitDialogToScreen( csd ); 129 //KOGlobals::fitDialogToScreen( csd );
129 csd->setColorEnabled(); 130 csd->setColorEnabled();
130 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 131 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
131 csd->exec(); 132 csd->exec();
132 delete csd; 133 delete csd;
133} 134}
134void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 135void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
135{ 136{
136 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 137 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
137 138
138 mCategoriesButton = new QPushButton(parent); 139 mCategoriesButton = new QPushButton(parent);
139 mCategoriesButton->setText(i18n("Categories...")); 140 mCategoriesButton->setText(i18n("Categories..."));
140 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 141 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
141 categoriesLayout->addWidget(mCategoriesButton); 142 categoriesLayout->addWidget(mCategoriesButton);
142 143
143 mCategoriesLabel = new QLabel(parent); 144 mCategoriesLabel = new QLabel(parent);
144 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 145 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
145 categoriesLayout->addWidget(mCategoriesLabel,1); 146 categoriesLayout->addWidget(mCategoriesLabel,1);
146} 147}
147 148
148void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 149void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
149{ 150{
150 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 151 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
151 152
152 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 153 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
153 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 154 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
154 secrecyLayout->addWidget(mCancelBox); 155 secrecyLayout->addWidget(mCancelBox);
155 secrecyLayout->addWidget(secrecyLabel); 156 secrecyLayout->addWidget(secrecyLabel);
156 157
157 mSecrecyCombo = new QComboBox(parent); 158 mSecrecyCombo = new QComboBox(parent);
158 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 159 mSecrecyCombo->insertStringList(Incidence::secrecyList());
159 secrecyLayout->addWidget(mSecrecyCombo); 160 secrecyLayout->addWidget(mSecrecyCombo);
160} 161}
161 162
162void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 163void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
163{ 164{
164 mDescriptionEdit = new KTextEdit(parent); 165 mDescriptionEdit = new KTextEdit(parent);
165 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 166 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
166 mDescriptionEdit->append(""); 167 mDescriptionEdit->append("");
167 mDescriptionEdit->setReadOnly(false); 168 mDescriptionEdit->setReadOnly(false);
168 mDescriptionEdit->setOverwriteMode(false); 169 mDescriptionEdit->setOverwriteMode(false);
169 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 170 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
170 topLayout->addWidget(mDescriptionEdit); 171 topLayout->addWidget(mDescriptionEdit);
171#ifndef DESKTOP_VERSION 172#ifndef DESKTOP_VERSION
172 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 173 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
173#endif 174#endif
174 175
175} 176}
176 177
177void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 178void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
178{ 179{
179 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 180 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
180 181
181 //mAlarmBell = new QLabel(parent); 182 //mAlarmBell = new QLabel(parent);
182 //mAlarmBell->setPixmap(SmallIcon("bell")); 183 //mAlarmBell->setPixmap(SmallIcon("bell"));
183 //alarmLayout->addWidget(mAlarmBell); 184 //alarmLayout->addWidget(mAlarmBell);
184 if ( QApplication::desktop()->width() < 320 ) 185 if ( QApplication::desktop()->width() < 320 )
185 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 186 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
186 else 187 else
187 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 188 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
188 189
189 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 190 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
190 alarmLayout->addWidget(mAlarmButton); 191 alarmLayout->addWidget(mAlarmButton);
191 192
192 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 193 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
193 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 194 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
194 alarmLayout->addWidget(mAlarmTimeEdit); 195 alarmLayout->addWidget(mAlarmTimeEdit);
195 mAlarmIncrCombo = new QComboBox(false, parent); 196 mAlarmIncrCombo = new QComboBox(false, parent);
196 if ( QApplication::desktop()->width() < 320 ) { 197 if ( QApplication::desktop()->width() < 320 ) {
197 mAlarmIncrCombo->insertItem(i18n("min")); 198 mAlarmIncrCombo->insertItem(i18n("min"));
198 mAlarmIncrCombo->insertItem(i18n("hou")); 199 mAlarmIncrCombo->insertItem(i18n("hou"));
199 mAlarmIncrCombo->insertItem(i18n("day")); 200 mAlarmIncrCombo->insertItem(i18n("day"));
200 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 201 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
201 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 202 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
202 } else { 203 } else {
203 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 204 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
204 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 205 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
205 mAlarmIncrCombo->insertItem(i18n("day(s)")); 206 mAlarmIncrCombo->insertItem(i18n("day(s)"));
206 } 207 }
207 208
208 // mAlarmIncrCombo->setMinimumHeight(20); 209 // mAlarmIncrCombo->setMinimumHeight(20);
209 alarmLayout->addWidget(mAlarmIncrCombo); 210 alarmLayout->addWidget(mAlarmIncrCombo);
210 mAlarmSoundButton = new QPushButton(parent); 211 mAlarmSoundButton = new QPushButton(parent);
211 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 212 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
212 mAlarmSoundButton->setToggleButton(true); 213 mAlarmSoundButton->setToggleButton(true);
213 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 214 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
214 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 215 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
215 alarmLayout->addWidget(mAlarmSoundButton); 216 alarmLayout->addWidget(mAlarmSoundButton);
216 217
217 mAlarmProgramButton = new QPushButton(parent); 218 mAlarmProgramButton = new QPushButton(parent);
218 mAlarmProgramButton->setPixmap(SmallIcon("run")); 219 mAlarmProgramButton->setPixmap(SmallIcon("run"));
219 mAlarmProgramButton->setToggleButton(true); 220 mAlarmProgramButton->setToggleButton(true);
220 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 221 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
221 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 222 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
222 alarmLayout->addWidget(mAlarmProgramButton); 223 alarmLayout->addWidget(mAlarmProgramButton);
223 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 224 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );