summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditorgeneral.cpp
Unidiff
Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 0045b7f..bfe0aec 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,203 +1,213 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34 34
35 35
36#include <kglobal.h> 36#include <kglobal.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <klocale.h> 38#include <klocale.h>
39#include <kiconloader.h> 39#include <kiconloader.h>
40#include <kmessagebox.h> 40#include <kmessagebox.h>
41#include <kfiledialog.h> 41#include <kfiledialog.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43 43
44#include <libkcal/todo.h> 44#include <libkcal/todo.h>
45#include <libkcal/event.h> 45#include <libkcal/event.h>
46#include <libkdepim/categoryselectdialog.h> 46#include <libkdepim/categoryselectdialog.h>
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50#include "koglobals.h" 50#include "koglobals.h"
51 51
52#include "koeditorgeneral.h" 52#include "koeditorgeneral.h"
53#include "kolocationbox.h" 53#include "kolocationbox.h"
54#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
56#else 56#else
57#include <qapplication.h> 57#include <qapplication.h>
58#endif 58#endif
59 59
60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
61 QObject( parent, name) 61 QObject( parent, name)
62{ 62{
63 mNextFocus = 0; 63 mNextFocus = 0;
64} 64}
65 65
66KOEditorGeneral::~KOEditorGeneral() 66KOEditorGeneral::~KOEditorGeneral()
67{ 67{
68} 68}
69 69
70void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 70void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
71{ 71{
72 QGridLayout *headerLayout = new QGridLayout(topLayout); 72 QGridLayout *headerLayout = new QGridLayout(topLayout);
73 73
74#if 0 74#if 0
75 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 75 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
76 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 76 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
77#endif 77#endif
78 78
79 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 79 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
80 headerLayout->addWidget(summaryLabel,1,0); 80 headerLayout->addWidget(summaryLabel,1,0);
81 81
82 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 82 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
83 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 83 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
84 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 84 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
85 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 85 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
86 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 86 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
87 if ( QApplication::desktop()->width() > 320 ) 87 if ( QApplication::desktop()->width() > 320 )
88 mSummaryEdit->setMaximumHeight( hei +6 ); 88 mSummaryEdit->setMaximumHeight( hei +6 );
89 //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 );
90 // 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 }
91 // mSummaryEdit = new QLineEdit(parent); 91 // mSummaryEdit = new QLineEdit(parent);
92 headerLayout->addWidget(mSummaryEdit,1,1); 92 headerLayout->addWidget(mSummaryEdit,1,1);
93 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 93 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
94 94
95 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 95 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(locationLabel,1,2);
98 else
96 headerLayout->addWidget(locationLabel,2,0); 99 headerLayout->addWidget(locationLabel,2,0);
97 100
98 mLocationEdit = new KOLocationBox(TRUE,parent,10); 101 mLocationEdit = new KOLocationBox(TRUE,parent,10);
99 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 102 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
100 if ( QApplication::desktop()->width() > 320 ) 103 if ( QApplication::desktop()->width() > 320 )
101 mLocationEdit->setMaximumHeight( hei + 6); 104 mLocationEdit->setMaximumHeight( hei + 6);
102 105
103 // mLocationEdit = new QLineEdit(parent); 106 // mLocationEdit = new QLineEdit(parent);
104 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 107 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
108 if ( QApplication::desktop()->height() < 320 ) {
109 headerLayout->addWidget(mLocationEdit,1,3);
110 headerLayout->setColStretch( 1, 10);
111 headerLayout->setColStretch( 3, 10);
112 }
113 else {
105 headerLayout->addWidget(mLocationEdit,2,1); 114 headerLayout->addWidget(mLocationEdit,2,1);
106 headerLayout->setColStretch( 1, 10); 115 headerLayout->setColStretch( 1, 10);
107} 116}
117}
108void KOEditorGeneral::setFocusOn( int i ) 118void KOEditorGeneral::setFocusOn( int i )
109{ 119{
110 mNextFocus = i; 120 mNextFocus = i;
111 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 121 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
112} 122}
113void KOEditorGeneral::slotSetFocusOn() 123void KOEditorGeneral::slotSetFocusOn()
114{ 124{
115 mNextFocus; 125 mNextFocus;
116 if ( mNextFocus == 1 ) { 126 if ( mNextFocus == 1 ) {
117 mDescriptionEdit->setFocus(); 127 mDescriptionEdit->setFocus();
118 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 128 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
119 } 129 }
120 if ( mNextFocus == 2 ) { 130 if ( mNextFocus == 2 ) {
121 mSummaryEdit->setFocus(); 131 mSummaryEdit->setFocus();
122 } 132 }
123} 133}
124void KOEditorGeneral::editCategories() 134void KOEditorGeneral::editCategories()
125{ 135{
126 // qDebug("KOEditorGeneral::editCategories() "); 136 // qDebug("KOEditorGeneral::editCategories() ");
127 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 137 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
128 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 138 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
129 //KOGlobals::fitDialogToScreen( csd ); 139 //KOGlobals::fitDialogToScreen( csd );
130 csd->setColorEnabled(); 140 csd->setColorEnabled();
131 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 141 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
132 csd->exec(); 142 csd->exec();
133 delete csd; 143 delete csd;
134} 144}
135void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 145void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
136{ 146{
137 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 147 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
138 148
139 mCategoriesButton = new QPushButton(parent); 149 mCategoriesButton = new QPushButton(parent);
140 mCategoriesButton->setText(i18n("Categories...")); 150 mCategoriesButton->setText(i18n("Categories..."));
141 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 151 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
142 categoriesLayout->addWidget(mCategoriesButton); 152 categoriesLayout->addWidget(mCategoriesButton);
143 153
144 mCategoriesLabel = new QLabel(parent); 154 mCategoriesLabel = new QLabel(parent);
145 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 155 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
146 categoriesLayout->addWidget(mCategoriesLabel,1); 156 categoriesLayout->addWidget(mCategoriesLabel,1);
147} 157}
148 158
149void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 159void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
150{ 160{
151 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 161 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
152 162
153 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 163 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
154 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 164 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
155 secrecyLayout->addWidget(mCancelBox); 165 secrecyLayout->addWidget(mCancelBox);
156 secrecyLayout->addWidget(secrecyLabel); 166 secrecyLayout->addWidget(secrecyLabel);
157 167
158 mSecrecyCombo = new QComboBox(parent); 168 mSecrecyCombo = new QComboBox(parent);
159 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 169 mSecrecyCombo->insertStringList(Incidence::secrecyList());
160 secrecyLayout->addWidget(mSecrecyCombo); 170 secrecyLayout->addWidget(mSecrecyCombo);
161} 171}
162 172
163void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 173void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
164{ 174{
165 mDescriptionEdit = new KTextEdit(parent); 175 mDescriptionEdit = new KTextEdit(parent);
166 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 176 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
167 mDescriptionEdit->append(""); 177 mDescriptionEdit->append("");
168 mDescriptionEdit->setReadOnly(false); 178 mDescriptionEdit->setReadOnly(false);
169 mDescriptionEdit->setOverwriteMode(false); 179 mDescriptionEdit->setOverwriteMode(false);
170 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 180 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
171 topLayout->addWidget(mDescriptionEdit); 181 topLayout->addWidget(mDescriptionEdit);
172#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
173 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 183 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
174#endif 184#endif
175 185
176} 186}
177 187
178void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 188void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
179{ 189{
180 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 190 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
181 191
182 //mAlarmBell = new QLabel(parent); 192 //mAlarmBell = new QLabel(parent);
183 //mAlarmBell->setPixmap(SmallIcon("bell")); 193 //mAlarmBell->setPixmap(SmallIcon("bell"));
184 //alarmLayout->addWidget(mAlarmBell); 194 //alarmLayout->addWidget(mAlarmBell);
185 if ( QApplication::desktop()->width() < 320 ) 195 if ( QApplication::desktop()->width() < 320 )
186 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 196 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
187 else 197 else
188 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 198 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
189 199
190 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 200 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
191 alarmLayout->addWidget(mAlarmButton); 201 alarmLayout->addWidget(mAlarmButton);
192 202
193 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 203 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
194 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 204 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
195 alarmLayout->addWidget(mAlarmTimeEdit); 205 alarmLayout->addWidget(mAlarmTimeEdit);
196 mAlarmIncrCombo = new QComboBox(false, parent); 206 mAlarmIncrCombo = new QComboBox(false, parent);
197 if ( QApplication::desktop()->width() < 320 ) { 207 if ( QApplication::desktop()->width() < 320 ) {
198 mAlarmIncrCombo->insertItem(i18n("min")); 208 mAlarmIncrCombo->insertItem(i18n("min"));
199 mAlarmIncrCombo->insertItem(i18n("hou")); 209 mAlarmIncrCombo->insertItem(i18n("hou"));
200 mAlarmIncrCombo->insertItem(i18n("day")); 210 mAlarmIncrCombo->insertItem(i18n("day"));
201 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 211 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
202 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 212 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
203 } else { 213 } else {