summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 753630b..407a5d5 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,320 +1,321 @@
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#include <qregexp.h>
35 35
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kfiledialog.h> 43#include <kfiledialog.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45 45
46#include <libkcal/todo.h> 46#include <libkcal/todo.h>
47#include <libkcal/event.h> 47#include <libkcal/event.h>
48#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
49#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52#include "koglobals.h" 52#include "koglobals.h"
53 53
54#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
55#include "kolocationbox.h" 55#include "kolocationbox.h"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#else 58#else
59#include <qapplication.h> 59#include <qapplication.h>
60#endif 60#endif
61 61
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 63 QObject( parent, name)
64{ 64{
65 mNextFocus = 0; 65 mNextFocus = 0;
66} 66}
67 67
68KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
69{ 69{
70} 70}
71 71
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
73{ 73{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
75 75
76#if 0 76#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 79#endif
80 // 1 on pda 80 // 1 on pda
81 // 11 on desktop 81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 84 headerLayout->addWidget(summaryLabel,0,0);
85 85
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
91 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
92 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
95 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
96 if ( QApplication::desktop()->height() < 320 ) 96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(mSummaryEdit,0,1); 97 headerLayout->addWidget(mSummaryEdit,0,1);
98 else 98 else
99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); 99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
101 101
102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
103 if ( QApplication::desktop()->height() < 320 ) 103 if ( QApplication::desktop()->height() < 320 )
104 headerLayout->addWidget(locationLabel,0,2); 104 headerLayout->addWidget(locationLabel,0,2);
105 else 105 else
106 headerLayout->addWidget(locationLabel,1,0); 106 headerLayout->addWidget(locationLabel,1,0);
107 107
108 mLocationEdit = new KOLocationBox(TRUE,parent,10); 108 mLocationEdit = new KOLocationBox(TRUE,parent,10);
109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
111 mLocationEdit->setMaximumHeight( hei + 6); 111 mLocationEdit->setMaximumHeight( hei + 6);
112 112
113 // mLocationEdit = new QLineEdit(parent); 113 // mLocationEdit = new QLineEdit(parent);
114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
115 115
116 mCalendarBox = new QComboBox ( parent ); 116 mCalendarBox = new QComboBox ( parent );
117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
118 if ( QApplication::desktop()->height() < 320 ) { 118 if ( QApplication::desktop()->height() < 320 ) {
119 headerLayout->addWidget(mLocationEdit,0,3); 119 headerLayout->addWidget(mLocationEdit,0,3);
120 headerLayout->addWidget(mCalendarBox,0,4); 120 headerLayout->addWidget(mCalendarBox,0,4);
121 headerLayout->setColStretch( 1, 10); 121 headerLayout->setColStretch( 1, 10);
122 headerLayout->setColStretch( 3, 10); 122 headerLayout->setColStretch( 3, 10);
123 mCalendarBox->setMaximumWidth( 64 ); 123 mCalendarBox->setMaximumWidth( 64 );
124 } 124 }
125 else { 125 else {
126 headerLayout->addWidget(mLocationEdit,1,1); 126 headerLayout->addWidget(mLocationEdit,1,1);
127 headerLayout->addWidget(mCalendarBox,1,2); 127 headerLayout->addWidget(mCalendarBox,1,2);
128 headerLayout->setColStretch( 1, 10); 128 headerLayout->setColStretch( 1, 3);
129 headerLayout->setColStretch( 2, 1);
129 } 130 }
130 131
131} 132}
132void KOEditorGeneral::setFocusOn( int i ) 133void KOEditorGeneral::setFocusOn( int i )
133{ 134{
134 mNextFocus = i; 135 mNextFocus = i;
135 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 136 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
136} 137}
137void KOEditorGeneral::slotSetFocusOn() 138void KOEditorGeneral::slotSetFocusOn()
138{ 139{
139 mNextFocus; 140 mNextFocus;
140 if ( mNextFocus == 1 ) { 141 if ( mNextFocus == 1 ) {
141 mDescriptionEdit->setFocus(); 142 mDescriptionEdit->setFocus();
142 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 143 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
143 } 144 }
144 if ( mNextFocus == 2 ) { 145 if ( mNextFocus == 2 ) {
145 mSummaryEdit->setFocus(); 146 mSummaryEdit->setFocus();
146 } 147 }
147} 148}
148void KOEditorGeneral::editCategories() 149void KOEditorGeneral::editCategories()
149{ 150{
150 // qDebug("KOEditorGeneral::editCategories() "); 151 // qDebug("KOEditorGeneral::editCategories() ");
151 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 152 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
152 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 153 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
153 //KOGlobals::fitDialogToScreen( csd ); 154 //KOGlobals::fitDialogToScreen( csd );
154 csd->setColorEnabled(); 155 csd->setColorEnabled();
155 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 156 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
156 csd->exec(); 157 csd->exec();
157 delete csd; 158 delete csd;
158} 159}
159 160
160void KOEditorGeneral::showCatPopup() 161void KOEditorGeneral::showCatPopup()
161{ 162{
162 mCatPopup->clear(); 163 mCatPopup->clear();
163 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 164 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
164 int index = 0; 165 int index = 0;
165 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 166 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
166 it != KOPrefs::instance()->mCustomCategories.end (); 167 it != KOPrefs::instance()->mCustomCategories.end ();
167 ++it) { 168 ++it) {
168 mCatPopup->insertItem (*it, index ); 169 mCatPopup->insertItem (*it, index );
169 //mCategory[index] = *it; 170 //mCategory[index] = *it;
170 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 171 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
171 ++index; 172 ++index;
172 } 173 }
173} 174}
174void KOEditorGeneral::selectedCatPopup( int index ) 175void KOEditorGeneral::selectedCatPopup( int index )
175{ 176{
176 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 177 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
177 QString colcat = categories.first(); 178 QString colcat = categories.first();
178 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 179 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
179 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 180 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
180 else 181 else
181 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 182 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
182 categories.sort (); 183 categories.sort ();
183 if ( !colcat.isEmpty() ) { 184 if ( !colcat.isEmpty() ) {
184 if ( categories.find ( colcat ) != categories.end () ) { 185 if ( categories.find ( colcat ) != categories.end () ) {
185 categories.remove( colcat ); 186 categories.remove( colcat );
186 categories.prepend( colcat ); 187 categories.prepend( colcat );
187 } 188 }
188 } 189 }
189 setCategories( categories.join(",") ); 190 setCategories( categories.join(",") );
190} 191}
191 192
192void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 193void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
193{ 194{
194 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 195 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
195 mCatPopup = new QPopupMenu ( parent ); 196 mCatPopup = new QPopupMenu ( parent );
196 mCatPopup->setCheckable (true); 197 mCatPopup->setCheckable (true);
197 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 198 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
198 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 199 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
199 mCategoriesButton = new QPushButton(parent); 200 mCategoriesButton = new QPushButton(parent);
200 mCategoriesButton->setText(i18n("Categories...")); 201 mCategoriesButton->setText(i18n("Categories..."));
201 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 202 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
202 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 203 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
203 categoriesLayout->addWidget(mCategoriesButton); 204 categoriesLayout->addWidget(mCategoriesButton);
204 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 205 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
205 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 206 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
206 mCategoriesLabel->setPopup( mCatPopup ); 207 mCategoriesLabel->setPopup( mCatPopup );
207 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 208 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
208 categoriesLayout->addWidget(mCategoriesLabel,1); 209 categoriesLayout->addWidget(mCategoriesLabel,1);
209} 210}
210 211
211void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 212void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
212{ 213{
213 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 214 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
214 215
215 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 216 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
216 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 217 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
217 secrecyLayout->addWidget(mCancelBox); 218 secrecyLayout->addWidget(mCancelBox);
218 secrecyLayout->addWidget(secrecyLabel); 219 secrecyLayout->addWidget(secrecyLabel);
219 220
220 mSecrecyCombo = new QComboBox(parent); 221 mSecrecyCombo = new QComboBox(parent);
221 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 222 mSecrecyCombo->insertStringList(Incidence::secrecyList());
222 secrecyLayout->addWidget(mSecrecyCombo); 223 secrecyLayout->addWidget(mSecrecyCombo);
223} 224}
224 225
225void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 226void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
226{ 227{
227 mDescriptionEdit = new KTextEdit(parent); 228 mDescriptionEdit = new KTextEdit(parent);
228 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 229 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
229 mDescriptionEdit->append(""); 230 mDescriptionEdit->append("");
230 mDescriptionEdit->setReadOnly(false); 231 mDescriptionEdit->setReadOnly(false);
231 mDescriptionEdit->setOverwriteMode(false); 232 mDescriptionEdit->setOverwriteMode(false);
232 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 233 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
233 topLayout->addWidget(mDescriptionEdit); 234 topLayout->addWidget(mDescriptionEdit);
234#ifndef DESKTOP_VERSION 235#ifndef DESKTOP_VERSION
235 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 236 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
236#endif 237#endif
237 238
238} 239}
239 240
240void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 241void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
241{ 242{
242 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 243 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
243 244
244 //mAlarmBell = new QLabel(parent); 245 //mAlarmBell = new QLabel(parent);
245 //mAlarmBell->setPixmap(SmallIcon("bell")); 246 //mAlarmBell->setPixmap(SmallIcon("bell"));
246 //alarmLayout->addWidget(mAlarmBell); 247 //alarmLayout->addWidget(mAlarmBell);
247 if ( QApplication::desktop()->width() < 320 ) 248 if ( QApplication::desktop()->width() < 320 )
248 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 249 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
249 else 250 else
250 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 251 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
251 252
252 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 253 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
253 alarmLayout->addWidget(mAlarmButton); 254 alarmLayout->addWidget(mAlarmButton);
254 255
255 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 256 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
256 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 257 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
257 alarmLayout->addWidget(mAlarmTimeEdit); 258 alarmLayout->addWidget(mAlarmTimeEdit);
258 mAlarmIncrCombo = new QComboBox(false, parent); 259 mAlarmIncrCombo = new QComboBox(false, parent);
259 if ( QApplication::desktop()->width() < 320 ) { 260 if ( QApplication::desktop()->width() < 320 ) {
260 mAlarmIncrCombo->insertItem(i18n("min")); 261 mAlarmIncrCombo->insertItem(i18n("min"));
261 mAlarmIncrCombo->insertItem(i18n("hou")); 262 mAlarmIncrCombo->insertItem(i18n("hou"));
262 mAlarmIncrCombo->insertItem(i18n("day")); 263 mAlarmIncrCombo->insertItem(i18n("day"));
263 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 264 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
264 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 265 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
265 } else { 266 } else {
266 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 267 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
267 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 268 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
268 mAlarmIncrCombo->insertItem(i18n("day(s)")); 269 mAlarmIncrCombo->insertItem(i18n("day(s)"));
269 } 270 }
270 271
271 // mAlarmIncrCombo->setMinimumHeight(20); 272 // mAlarmIncrCombo->setMinimumHeight(20);
272 alarmLayout->addWidget(mAlarmIncrCombo); 273 alarmLayout->addWidget(mAlarmIncrCombo);
273 mAlarmSoundButton = new QPushButton(parent); 274 mAlarmSoundButton = new QPushButton(parent);
274 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 275 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
275 mAlarmSoundButton->setToggleButton(true); 276 mAlarmSoundButton->setToggleButton(true);
276 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 277 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
277 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 278 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
278 alarmLayout->addWidget(mAlarmSoundButton); 279 alarmLayout->addWidget(mAlarmSoundButton);
279 280
280 mAlarmProgramButton = new QPushButton(parent); 281 mAlarmProgramButton = new QPushButton(parent);
281 mAlarmProgramButton->setPixmap(SmallIcon("run")); 282 mAlarmProgramButton->setPixmap(SmallIcon("run"));
282 mAlarmProgramButton->setToggleButton(true); 283 mAlarmProgramButton->setToggleButton(true);
283 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 284 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
284 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 285 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
285 alarmLayout->addWidget(mAlarmProgramButton); 286 alarmLayout->addWidget(mAlarmProgramButton);
286 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 287 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
287 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 288 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
288 // if ( KOPrefs::instance()->mCompactDialogs ) { 289 // if ( KOPrefs::instance()->mCompactDialogs ) {
289 // mAlarmSoundButton->hide(); 290 // mAlarmSoundButton->hide();
290 // mAlarmProgramButton->hide(); 291 // mAlarmProgramButton->hide();
291 // } 292 // }
292} 293}
293 294
294void KOEditorGeneral::pickAlarmSound() 295void KOEditorGeneral::pickAlarmSound()
295{ 296{
296 297
297 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 298 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
298 299
299 bool oldState = mAlarmSoundButton->isOn(); 300 bool oldState = mAlarmSoundButton->isOn();
300 301
301 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 302 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
302 i18n("*.wav|Wav Files"), 0)); 303 i18n("*.wav|Wav Files"), 0));
303 if (!fileName.isEmpty()) { 304 if (!fileName.isEmpty()) {
304 mAlarmSound = fileName; 305 mAlarmSound = fileName;
305 QToolTip::remove(mAlarmSoundButton); 306 QToolTip::remove(mAlarmSoundButton);
306 QString dispStr = i18n("Playing '%1'").arg(fileName); 307 QString dispStr = i18n("Playing '%1'").arg(fileName);
307 QToolTip::add(mAlarmSoundButton, dispStr); 308 QToolTip::add(mAlarmSoundButton, dispStr);
308 mAlarmProgramButton->setOn(false); 309 mAlarmProgramButton->setOn(false);
309 mAlarmSoundButton->setOn(true); 310 mAlarmSoundButton->setOn(true);
310 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 311 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
311 } else { 312 } else {
312 mAlarmProgramButton->setOn(oldState); 313 mAlarmProgramButton->setOn(oldState);
313 mAlarmSoundButton->setOn(!oldState); 314 mAlarmSoundButton->setOn(!oldState);
314 315
315 316
316 } 317 }
317 318
318 if (mAlarmProgramButton->isOn()) 319 if (mAlarmProgramButton->isOn())
319 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 320 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
320 if ( mAlarmSoundButton->isOn()) 321 if ( mAlarmSoundButton->isOn())