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