-rw-r--r-- | korganizer/koeditorgeneral.cpp | 1 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 92fcd1c..b14ca43 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -1,379 +1,380 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kiconloader.h> | 38 | #include <kiconloader.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kfiledialog.h> | 40 | #include <kfiledialog.h> |
41 | #include <kstandarddirs.h> | 41 | #include <kstandarddirs.h> |
42 | 42 | ||
43 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkdepim/categoryselectdialog.h> | 45 | #include <libkdepim/categoryselectdialog.h> |
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "koglobals.h" | 49 | #include "koglobals.h" |
50 | 50 | ||
51 | #include "koeditorgeneral.h" | 51 | #include "koeditorgeneral.h" |
52 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #else | 55 | #else |
56 | #include <qapplication.h> | 56 | #include <qapplication.h> |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
60 | QObject( parent, name) | 60 | QObject( parent, name) |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | KOEditorGeneral::~KOEditorGeneral() | 64 | KOEditorGeneral::~KOEditorGeneral() |
65 | { | 65 | { |
66 | } | 66 | } |
67 | 67 | ||
68 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 68 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
69 | { | 69 | { |
70 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 70 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
71 | 71 | ||
72 | #if 0 | 72 | #if 0 |
73 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 73 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
74 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 74 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 77 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
78 | headerLayout->addWidget(summaryLabel,1,0); | 78 | headerLayout->addWidget(summaryLabel,1,0); |
79 | 79 | ||
80 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 80 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
81 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 81 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
82 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 82 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
83 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 83 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
84 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 84 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
85 | if ( QApplication::desktop()->width() > 320 ) | 85 | if ( QApplication::desktop()->width() > 320 ) |
86 | mSummaryEdit->setMaximumHeight( hei +6 ); | 86 | mSummaryEdit->setMaximumHeight( hei +6 ); |
87 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 87 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
88 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 88 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
89 | // mSummaryEdit = new QLineEdit(parent); | 89 | // mSummaryEdit = new QLineEdit(parent); |
90 | headerLayout->addWidget(mSummaryEdit,1,1); | 90 | headerLayout->addWidget(mSummaryEdit,1,1); |
91 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 91 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
92 | 92 | ||
93 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 93 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
94 | headerLayout->addWidget(locationLabel,2,0); | 94 | headerLayout->addWidget(locationLabel,2,0); |
95 | 95 | ||
96 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 96 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
97 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 97 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
98 | if ( QApplication::desktop()->width() > 320 ) | 98 | if ( QApplication::desktop()->width() > 320 ) |
99 | mLocationEdit->setMaximumHeight( hei + 6); | 99 | mLocationEdit->setMaximumHeight( hei + 6); |
100 | 100 | ||
101 | // mLocationEdit = new QLineEdit(parent); | 101 | // mLocationEdit = new QLineEdit(parent); |
102 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 102 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
103 | headerLayout->addWidget(mLocationEdit,2,1); | 103 | headerLayout->addWidget(mLocationEdit,2,1); |
104 | headerLayout->setColStretch( 1, 10); | 104 | headerLayout->setColStretch( 1, 10); |
105 | } | 105 | } |
106 | void KOEditorGeneral::setFocusOn( int i ) | 106 | void KOEditorGeneral::setFocusOn( int i ) |
107 | { | 107 | { |
108 | qApp->processEvents(); | 108 | qApp->processEvents(); |
109 | if ( i == 1 ) { | 109 | if ( i == 1 ) { |
110 | mDescriptionEdit->setFocus(); | 110 | mDescriptionEdit->setFocus(); |
111 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 111 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
112 | } | 112 | } |
113 | if ( i == 2 ) { | 113 | if ( i == 2 ) { |
114 | mSummaryEdit->setFocus(); | 114 | mSummaryEdit->setFocus(); |
115 | } | 115 | } |
116 | 116 | ||
117 | } | 117 | } |
118 | void KOEditorGeneral::editCategories() | 118 | void KOEditorGeneral::editCategories() |
119 | { | 119 | { |
120 | // qDebug("KOEditorGeneral::editCategories() "); | 120 | // qDebug("KOEditorGeneral::editCategories() "); |
121 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 121 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
122 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 122 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
123 | //KOGlobals::fitDialogToScreen( csd ); | 123 | //KOGlobals::fitDialogToScreen( csd ); |
124 | csd->setColorEnabled(); | 124 | csd->setColorEnabled(); |
125 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 125 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
126 | csd->exec(); | 126 | csd->exec(); |
127 | delete csd; | 127 | delete csd; |
128 | } | 128 | } |
129 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 129 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
130 | { | 130 | { |
131 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 131 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
132 | 132 | ||
133 | mCategoriesButton = new QPushButton(parent); | 133 | mCategoriesButton = new QPushButton(parent); |
134 | mCategoriesButton->setText(i18n("Categories...")); | 134 | mCategoriesButton->setText(i18n("Categories...")); |
135 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 135 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
136 | categoriesLayout->addWidget(mCategoriesButton); | 136 | categoriesLayout->addWidget(mCategoriesButton); |
137 | 137 | ||
138 | mCategoriesLabel = new QLabel(parent); | 138 | mCategoriesLabel = new QLabel(parent); |
139 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 139 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
140 | categoriesLayout->addWidget(mCategoriesLabel,1); | 140 | categoriesLayout->addWidget(mCategoriesLabel,1); |
141 | } | 141 | } |
142 | 142 | ||
143 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 143 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
144 | { | 144 | { |
145 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 145 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
146 | 146 | ||
147 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 147 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
148 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 148 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
149 | secrecyLayout->addWidget(mCancelBox); | 149 | secrecyLayout->addWidget(mCancelBox); |
150 | secrecyLayout->addWidget(secrecyLabel); | 150 | secrecyLayout->addWidget(secrecyLabel); |
151 | 151 | ||
152 | mSecrecyCombo = new QComboBox(parent); | 152 | mSecrecyCombo = new QComboBox(parent); |
153 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 153 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
154 | secrecyLayout->addWidget(mSecrecyCombo); | 154 | secrecyLayout->addWidget(mSecrecyCombo); |
155 | } | 155 | } |
156 | 156 | ||
157 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 157 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
158 | { | 158 | { |
159 | mDescriptionEdit = new KTextEdit(parent); | 159 | mDescriptionEdit = new KTextEdit(parent); |
160 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 160 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
161 | mDescriptionEdit->append(""); | 161 | mDescriptionEdit->append(""); |
162 | mDescriptionEdit->setReadOnly(false); | 162 | mDescriptionEdit->setReadOnly(false); |
163 | mDescriptionEdit->setOverwriteMode(false); | 163 | mDescriptionEdit->setOverwriteMode(false); |
164 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 164 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
165 | topLayout->addWidget(mDescriptionEdit); | 165 | topLayout->addWidget(mDescriptionEdit); |
166 | #ifndef DESKTOP_VERSION | 166 | #ifndef DESKTOP_VERSION |
167 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 167 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 172 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
173 | { | 173 | { |
174 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 174 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
175 | 175 | ||
176 | //mAlarmBell = new QLabel(parent); | 176 | //mAlarmBell = new QLabel(parent); |
177 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 177 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
178 | //alarmLayout->addWidget(mAlarmBell); | 178 | //alarmLayout->addWidget(mAlarmBell); |
179 | if ( QApplication::desktop()->width() < 320 ) | 179 | if ( QApplication::desktop()->width() < 320 ) |
180 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 180 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
181 | else | 181 | else |
182 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 182 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
183 | 183 | ||
184 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 184 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
185 | alarmLayout->addWidget(mAlarmButton); | 185 | alarmLayout->addWidget(mAlarmButton); |
186 | 186 | ||
187 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 187 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
188 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | ||
188 | alarmLayout->addWidget(mAlarmTimeEdit); | 189 | alarmLayout->addWidget(mAlarmTimeEdit); |
189 | mAlarmIncrCombo = new QComboBox(false, parent); | 190 | mAlarmIncrCombo = new QComboBox(false, parent); |
190 | if ( QApplication::desktop()->width() < 320 ) { | 191 | if ( QApplication::desktop()->width() < 320 ) { |
191 | mAlarmIncrCombo->insertItem(i18n("min")); | 192 | mAlarmIncrCombo->insertItem(i18n("min")); |
192 | mAlarmIncrCombo->insertItem(i18n("hou")); | 193 | mAlarmIncrCombo->insertItem(i18n("hou")); |
193 | mAlarmIncrCombo->insertItem(i18n("day")); | 194 | mAlarmIncrCombo->insertItem(i18n("day")); |
194 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 195 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
195 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 196 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
196 | } else { | 197 | } else { |
197 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 198 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
198 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 199 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
199 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 200 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
200 | } | 201 | } |
201 | 202 | ||
202 | // mAlarmIncrCombo->setMinimumHeight(20); | 203 | // mAlarmIncrCombo->setMinimumHeight(20); |
203 | alarmLayout->addWidget(mAlarmIncrCombo); | 204 | alarmLayout->addWidget(mAlarmIncrCombo); |
204 | mAlarmSoundButton = new QPushButton(parent); | 205 | mAlarmSoundButton = new QPushButton(parent); |
205 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 206 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
206 | mAlarmSoundButton->setToggleButton(true); | 207 | mAlarmSoundButton->setToggleButton(true); |
207 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 208 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
208 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 209 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
209 | alarmLayout->addWidget(mAlarmSoundButton); | 210 | alarmLayout->addWidget(mAlarmSoundButton); |
210 | 211 | ||
211 | mAlarmProgramButton = new QPushButton(parent); | 212 | mAlarmProgramButton = new QPushButton(parent); |
212 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 213 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
213 | mAlarmProgramButton->setToggleButton(true); | 214 | mAlarmProgramButton->setToggleButton(true); |
214 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 215 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
215 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 216 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
216 | alarmLayout->addWidget(mAlarmProgramButton); | 217 | alarmLayout->addWidget(mAlarmProgramButton); |
217 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 218 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
218 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 219 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
219 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 220 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
220 | // mAlarmSoundButton->hide(); | 221 | // mAlarmSoundButton->hide(); |
221 | // mAlarmProgramButton->hide(); | 222 | // mAlarmProgramButton->hide(); |
222 | // } | 223 | // } |
223 | } | 224 | } |
224 | 225 | ||
225 | void KOEditorGeneral::pickAlarmSound() | 226 | void KOEditorGeneral::pickAlarmSound() |
226 | { | 227 | { |
227 | 228 | ||
228 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); | 229 | qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); |
229 | //QString prefix = mAlarmSound; | 230 | //QString prefix = mAlarmSound; |
230 | if (!mAlarmSoundButton->isOn()) { | 231 | if (!mAlarmSoundButton->isOn()) { |
231 | mAlarmSoundButton->setOn(true); | 232 | mAlarmSoundButton->setOn(true); |
232 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 233 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
233 | } else { | 234 | } else { |
234 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 235 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
235 | i18n("*.wav|Wav Files"), 0)); | 236 | i18n("*.wav|Wav Files"), 0)); |
236 | if (!fileName.isEmpty()) { | 237 | if (!fileName.isEmpty()) { |
237 | mAlarmSound = fileName; | 238 | mAlarmSound = fileName; |
238 | QToolTip::remove(mAlarmSoundButton); | 239 | QToolTip::remove(mAlarmSoundButton); |
239 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 240 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
240 | QToolTip::add(mAlarmSoundButton, dispStr); | 241 | QToolTip::add(mAlarmSoundButton, dispStr); |
241 | mAlarmProgramButton->setOn(false); | 242 | mAlarmProgramButton->setOn(false); |
242 | mAlarmSoundButton->setOn(true); | 243 | mAlarmSoundButton->setOn(true); |
243 | } else { | 244 | } else { |
244 | mAlarmProgramButton->setOn(true); | 245 | mAlarmProgramButton->setOn(true); |
245 | mAlarmSoundButton->setOn(false); | 246 | mAlarmSoundButton->setOn(false); |
246 | 247 | ||
247 | } | 248 | } |
248 | } | 249 | } |
249 | #if 0 | 250 | #if 0 |
250 | if (mAlarmProgramButton->isOn()) | 251 | if (mAlarmProgramButton->isOn()) |
251 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 252 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
252 | if ( mAlarmSoundButton->isOn()) | 253 | if ( mAlarmSoundButton->isOn()) |
253 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 254 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
254 | #endif | 255 | #endif |
255 | } | 256 | } |
256 | 257 | ||
257 | void KOEditorGeneral::pickAlarmProgram() | 258 | void KOEditorGeneral::pickAlarmProgram() |
258 | { | 259 | { |
259 | if (!mAlarmProgramButton->isOn()) { | 260 | if (!mAlarmProgramButton->isOn()) { |
260 | mAlarmProgramButton->setOn(true); | 261 | mAlarmProgramButton->setOn(true); |
261 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 262 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
262 | } else { | 263 | } else { |
263 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 264 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
264 | if (!fileName.isEmpty()) { | 265 | if (!fileName.isEmpty()) { |
265 | mAlarmProgram = fileName; | 266 | mAlarmProgram = fileName; |
266 | QToolTip::remove(mAlarmProgramButton); | 267 | QToolTip::remove(mAlarmProgramButton); |
267 | QString dispStr = i18n("Running '%1'").arg(fileName); | 268 | QString dispStr = i18n("Running '%1'").arg(fileName); |
268 | QToolTip::add(mAlarmProgramButton, dispStr); | 269 | QToolTip::add(mAlarmProgramButton, dispStr); |
269 | mAlarmSoundButton->setOn(false); | 270 | mAlarmSoundButton->setOn(false); |
270 | mAlarmProgramButton->setOn(true); | 271 | mAlarmProgramButton->setOn(true); |
271 | } else { | 272 | } else { |
272 | mAlarmProgramButton->setOn(false); | 273 | mAlarmProgramButton->setOn(false); |
273 | mAlarmSoundButton->setOn(true); | 274 | mAlarmSoundButton->setOn(true); |
274 | } | 275 | } |
275 | } | 276 | } |
276 | #if 0 | 277 | #if 0 |
277 | if (mAlarmProgramButton->isOn()) | 278 | if (mAlarmProgramButton->isOn()) |
278 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 279 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
279 | if ( mAlarmSoundButton->isOn()) | 280 | if ( mAlarmSoundButton->isOn()) |
280 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 281 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
281 | #endif | 282 | #endif |
282 | } | 283 | } |
283 | 284 | ||
284 | 285 | ||
285 | QString KOEditorGeneral::getFittingPath( const QString s ) | 286 | QString KOEditorGeneral::getFittingPath( const QString s ) |
286 | { | 287 | { |
287 | int maxlen = 50; | 288 | int maxlen = 50; |
288 | if ( QApplication::desktop()->width() < 640 ) { | 289 | if ( QApplication::desktop()->width() < 640 ) { |
289 | if ( QApplication::desktop()->width() < 320 ) | 290 | if ( QApplication::desktop()->width() < 320 ) |
290 | maxlen = 22; | 291 | maxlen = 22; |
291 | else | 292 | else |
292 | maxlen = 35; | 293 | maxlen = 35; |
293 | } | 294 | } |
294 | if ( s.length() > maxlen ) { | 295 | if ( s.length() > maxlen ) { |
295 | return "..."+s.right(maxlen -3); | 296 | return "..."+s.right(maxlen -3); |
296 | } | 297 | } |
297 | return s; | 298 | return s; |
298 | } | 299 | } |
299 | 300 | ||
300 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 301 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
301 | { | 302 | { |
302 | if ( enable ) { | 303 | if ( enable ) { |
303 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 304 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
304 | mAlarmSoundButton->setOn( true ); | 305 | mAlarmSoundButton->setOn( true ); |
305 | if ( mAlarmSound.isEmpty() ) | 306 | if ( mAlarmSound.isEmpty() ) |
306 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 307 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
307 | else { | 308 | else { |
308 | if ( ! QFile::exists( mAlarmSound ) ) | 309 | if ( ! QFile::exists( mAlarmSound ) ) |
309 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 310 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
310 | } | 311 | } |
311 | } | 312 | } |
312 | } | 313 | } |
313 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | 314 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); |
314 | mAlarmTimeEdit->setEnabled(enable); | 315 | mAlarmTimeEdit->setEnabled(enable); |
315 | mAlarmSoundButton->setEnabled(enable); | 316 | mAlarmSoundButton->setEnabled(enable); |
316 | mAlarmProgramButton->setEnabled(enable); | 317 | mAlarmProgramButton->setEnabled(enable); |
317 | mAlarmIncrCombo->setEnabled(enable); | 318 | mAlarmIncrCombo->setEnabled(enable); |
318 | } | 319 | } |
319 | 320 | ||
320 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 321 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
321 | { | 322 | { |
322 | enableAlarmEdit( !disable ); | 323 | enableAlarmEdit( !disable ); |
323 | } | 324 | } |
324 | 325 | ||
325 | void KOEditorGeneral::enableAlarm( bool enable ) | 326 | void KOEditorGeneral::enableAlarm( bool enable ) |
326 | { | 327 | { |
327 | enableAlarmEdit( enable ); | 328 | enableAlarmEdit( enable ); |
328 | } | 329 | } |
329 | 330 | ||
330 | void KOEditorGeneral::alarmDisable(bool disable) | 331 | void KOEditorGeneral::alarmDisable(bool disable) |
331 | { | 332 | { |
332 | if (!disable) { | 333 | if (!disable) { |
333 | //mAlarmBell->setEnabled(true); | 334 | //mAlarmBell->setEnabled(true); |
334 | mAlarmButton->setEnabled(true); | 335 | mAlarmButton->setEnabled(true); |
335 | } else { | 336 | } else { |
336 | //mAlarmBell->setEnabled(false); | 337 | //mAlarmBell->setEnabled(false); |
337 | mAlarmButton->setEnabled(false); | 338 | mAlarmButton->setEnabled(false); |
338 | mAlarmButton->setChecked(false); | 339 | mAlarmButton->setChecked(false); |
339 | mAlarmTimeEdit->setEnabled(false); | 340 | mAlarmTimeEdit->setEnabled(false); |
340 | mAlarmSoundButton->setEnabled(false); | 341 | mAlarmSoundButton->setEnabled(false); |
341 | mAlarmProgramButton->setEnabled(false); | 342 | mAlarmProgramButton->setEnabled(false); |
342 | mAlarmIncrCombo->setEnabled(false); | 343 | mAlarmIncrCombo->setEnabled(false); |
343 | } | 344 | } |
344 | } | 345 | } |
345 | 346 | ||
346 | void KOEditorGeneral::setCategories(const QString &str) | 347 | void KOEditorGeneral::setCategories(const QString &str) |
347 | { | 348 | { |
348 | mCategoriesLabel->setText(str); | 349 | mCategoriesLabel->setText(str); |
349 | } | 350 | } |
350 | 351 | ||
351 | void KOEditorGeneral::setDefaults(bool allDay) | 352 | void KOEditorGeneral::setDefaults(bool allDay) |
352 | { | 353 | { |
353 | #if 0 | 354 | #if 0 |
354 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 355 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
355 | #endif | 356 | #endif |
356 | 357 | ||
357 | mAlarmMessage = i18n("Edit new item"); | 358 | mAlarmMessage = i18n("Edit new item"); |
358 | enableAlarmEdit( !allDay ); | 359 | enableAlarmEdit( !allDay ); |
359 | 360 | ||
360 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 361 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
361 | int alarmTime; | 362 | int alarmTime; |
362 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 363 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
363 | int index = KOPrefs::instance()->mAlarmTime; | 364 | int index = KOPrefs::instance()->mAlarmTime; |
364 | if (index < 0 || index > 7) { | 365 | if (index < 0 || index > 7) { |
365 | alarmTime = 15; | 366 | alarmTime = 15; |
366 | } else { | 367 | } else { |
367 | alarmTime = a[index]; | 368 | alarmTime = a[index]; |
368 | } | 369 | } |
369 | mAlarmButton ->setChecked( false ); | 370 | mAlarmButton ->setChecked( false ); |
370 | mAlarmTimeEdit->setValue(alarmTime); | 371 | mAlarmTimeEdit->setValue(alarmTime); |
371 | mAlarmIncrCombo->setCurrentItem(0); | 372 | mAlarmIncrCombo->setCurrentItem(0); |
372 | enableAlarmEdit( false ); | 373 | enableAlarmEdit( false ); |
373 | //alarmDisable (false); | 374 | //alarmDisable (false); |
374 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 375 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
375 | mCancelBox->setChecked( false ); | 376 | mCancelBox->setChecked( false ); |
376 | mSummaryEdit->setEditText(""); | 377 | mSummaryEdit->setEditText(""); |
377 | mLocationEdit->setEditText(""); | 378 | mLocationEdit->setEditText(""); |
378 | mDescriptionEdit->setText(""); | 379 | mDescriptionEdit->setText(""); |
379 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 380 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 678e1bd..341a839 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,358 +1,363 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qgroupbox.h> | 27 | #include <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkdepim/kdateedit.h> | 37 | #include <libkdepim/kdateedit.h> |
38 | 38 | ||
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "klineedit.h" | 41 | #include "klineedit.h" |
42 | 42 | ||
43 | #include "calendarview.h" | 43 | #include "calendarview.h" |
44 | #include "koviewmanager.h" | 44 | #include "koviewmanager.h" |
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | searchLabel = new QLabel(topFrame); | 58 | searchLabel = new QLabel(topFrame); |
59 | searchLabel->setText(i18n("Search for:")); | 59 | searchLabel->setText(i18n("Search for:")); |
60 | subLayout->addWidget(searchLabel); | 60 | subLayout->addWidget(searchLabel); |
61 | 61 | ||
62 | searchEdit = new KLineEdit(topFrame); | 62 | searchEdit = new KLineEdit(topFrame); |
63 | subLayout->addWidget(searchEdit); | 63 | subLayout->addWidget(searchEdit); |
64 | QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); | 64 | QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); |
65 | //OkButton->setDefault( true ); | 65 | //OkButton->setDefault( true ); |
66 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 66 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
67 | subLayout->addWidget(OkButton); | 67 | subLayout->addWidget(OkButton); |
68 | searchEdit->setText("*"); // Find all events by default | 68 | searchEdit->setText("*"); // Find all events by default |
69 | searchEdit->setFocus(); | 69 | searchEdit->setFocus(); |
70 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 70 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
71 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 71 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
72 | // Subjects to search | 72 | // Subjects to search |
73 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 73 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
74 | // topFrame); | 74 | // topFrame); |
75 | 75 | ||
76 | QHBox *incidenceGroup = new QHBox( topFrame ); | 76 | QHBox *incidenceGroup = new QHBox( topFrame ); |
77 | layout->addWidget(incidenceGroup); | 77 | layout->addWidget(incidenceGroup); |
78 | 78 | ||
79 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 79 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
80 | mSearchEvent->setChecked(true); | 80 | mSearchEvent->setChecked(true); |
81 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 81 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
82 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 82 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
83 | 83 | ||
84 | QHBox *subjectGroup = new QHBox( topFrame ); | 84 | QHBox *subjectGroup = new QHBox( topFrame ); |
85 | layout->addWidget(subjectGroup); | 85 | layout->addWidget(subjectGroup); |
86 | 86 | ||
87 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 87 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
88 | mSummaryCheck->setChecked(true); | 88 | mSummaryCheck->setChecked(true); |
89 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 89 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
90 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 90 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
91 | 91 | ||
92 | QHBox *attendeeGroup = new QHBox( topFrame ); | 92 | QHBox *attendeeGroup = new QHBox( topFrame ); |
93 | layout->addWidget(attendeeGroup ); | 93 | layout->addWidget(attendeeGroup ); |
94 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 94 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
95 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 95 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
96 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 96 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
97 | // Date range | 97 | // Date range |
98 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 98 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
99 | // topFrame); | 99 | // topFrame); |
100 | // layout->addWidget(rangeGroup); | 100 | // layout->addWidget(rangeGroup); |
101 | 101 | ||
102 | QWidget *rangeWidget = new QWidget(topFrame); | 102 | QWidget *rangeWidget = new QWidget(topFrame); |
103 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 103 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
104 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 104 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
105 | mStartDate = new KDateEdit(rangeWidget); | 105 | mStartDate = new KDateEdit(rangeWidget); |
106 | rangeLayout->addWidget(mStartDate); | 106 | rangeLayout->addWidget(mStartDate); |
107 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 107 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
108 | mEndDate = new KDateEdit(rangeWidget); | 108 | mEndDate = new KDateEdit(rangeWidget); |
109 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 109 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
110 | rangeLayout->addWidget(mEndDate); | 110 | rangeLayout->addWidget(mEndDate); |
111 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 111 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
112 | rangeLayout->addWidget( (QWidget*)wt ); | 112 | rangeLayout->addWidget( (QWidget*)wt ); |
113 | layout->addWidget(rangeWidget); | 113 | layout->addWidget(rangeWidget); |
114 | // Results list view | 114 | // Results list view |
115 | listView = new KOListView(mCalendar,topFrame); | 115 | listView = new KOListView(mCalendar,topFrame); |
116 | layout->addWidget(listView); | 116 | layout->addWidget(listView); |
117 | 117 | ||
118 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 118 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
119 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 119 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
120 | 120 | ||
121 | setCaption( i18n("KO/Pi Find: ")); | 121 | setCaption( i18n("KO/Pi Find: ")); |
122 | #ifdef DESKTOP_VERSION | 122 | #ifdef DESKTOP_VERSION |
123 | OkButton = new QPushButton( i18n("Close"), this ); | 123 | OkButton = new QPushButton( i18n("Close"), this ); |
124 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 124 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
125 | #endif | 125 | #endif |
126 | } | 126 | } |
127 | 127 | ||
128 | SearchDialog::~SearchDialog() | 128 | SearchDialog::~SearchDialog() |
129 | { | 129 | { |
130 | 130 | ||
131 | } | 131 | } |
132 | void SearchDialog::setFocusToList() | 132 | void SearchDialog::setFocusToList() |
133 | { | 133 | { |
134 | listView->resetFocus(); | 134 | listView->resetFocus(); |
135 | } | 135 | } |
136 | void SearchDialog::accept() | 136 | void SearchDialog::accept() |
137 | { | 137 | { |
138 | doSearch(); | 138 | doSearch(); |
139 | } | 139 | } |
140 | void SearchDialog::updateList() | 140 | void SearchDialog::updateList() |
141 | { | 141 | { |
142 | //listView->updateList(); | 142 | //listView->updateList(); |
143 | if ( isVisible() ) { | 143 | if ( isVisible() ) { |
144 | updateView(); | 144 | updateView(); |
145 | //qDebug("SearchDialog::updated "); | 145 | //qDebug("SearchDialog::updated "); |
146 | } | 146 | } |
147 | else { | 147 | else { |
148 | listView->clear(); | 148 | listView->clear(); |
149 | //qDebug("SearchDialog::cleared "); | 149 | //qDebug("SearchDialog::cleared "); |
150 | 150 | ||
151 | } | 151 | } |
152 | } | 152 | } |
153 | void SearchDialog::searchTextChanged( const QString &_text ) | 153 | void SearchDialog::searchTextChanged( const QString &_text ) |
154 | { | 154 | { |
155 | #if 0 | 155 | #if 0 |
156 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 156 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
157 | #endif | 157 | #endif |
158 | } | 158 | } |
159 | 159 | ||
160 | void SearchDialog::doSearch() | 160 | void SearchDialog::doSearch() |
161 | { | 161 | { |
162 | QRegExp re; | 162 | QRegExp re; |
163 | 163 | ||
164 | re.setWildcard(true); // most people understand these better. | 164 | re.setWildcard(true); // most people understand these better. |
165 | re.setCaseSensitive(false); | 165 | re.setCaseSensitive(false); |
166 | re.setPattern(searchEdit->text()); | 166 | re.setPattern(searchEdit->text()); |
167 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | ||
168 | KMessageBox::sorry(this, | ||
169 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | ||
170 | return; | ||
171 | } | ||
167 | if (!re.isValid() ) { | 172 | if (!re.isValid() ) { |
168 | KMessageBox::sorry(this, | 173 | KMessageBox::sorry(this, |
169 | i18n("Invalid search expression,\ncannot perform " | 174 | i18n("Invalid search expression,\ncannot perform " |
170 | "the search.\nPlease enter a search expression\n" | 175 | "the search.\nPlease enter a search expression\n" |
171 | "using the wildcard characters\n '*' and '?'" | 176 | "using the wildcard characters\n '*' and '?'" |
172 | "where needed.")); | 177 | "where needed.")); |
173 | return; | 178 | return; |
174 | } | 179 | } |
175 | 180 | ||
176 | search(re); | 181 | search(re); |
177 | 182 | ||
178 | listView->setStartDate( mStartDate->date() ); | 183 | listView->setStartDate( mStartDate->date() ); |
179 | listView->showEvents(mMatchedEvents); | 184 | listView->showEvents(mMatchedEvents); |
180 | listView->addTodos(mMatchedTodos); | 185 | listView->addTodos(mMatchedTodos); |
181 | listView->addJournals(mMatchedJournals); | 186 | listView->addJournals(mMatchedJournals); |
182 | 187 | ||
183 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 188 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
184 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 189 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
185 | } else { | 190 | } else { |
186 | QString mess; | 191 | QString mess; |
187 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 192 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
188 | setCaption( i18n("KO/Pi Find: ") + mess); | 193 | setCaption( i18n("KO/Pi Find: ") + mess); |
189 | 194 | ||
190 | } | 195 | } |
191 | searchEdit->setFocus(); | 196 | searchEdit->setFocus(); |
192 | } | 197 | } |
193 | void SearchDialog::updateConfig() | 198 | void SearchDialog::updateConfig() |
194 | { | 199 | { |
195 | listView->updateConfig(); | 200 | listView->updateConfig(); |
196 | } | 201 | } |
197 | void SearchDialog::updateView() | 202 | void SearchDialog::updateView() |
198 | { | 203 | { |
199 | 204 | ||
200 | QRegExp re; | 205 | QRegExp re; |
201 | re.setWildcard(true); // most people understand these better. | 206 | re.setWildcard(true); // most people understand these better. |
202 | re.setCaseSensitive(false); | 207 | re.setCaseSensitive(false); |
203 | re.setPattern(searchEdit->text()); | 208 | re.setPattern(searchEdit->text()); |
204 | if (re.isValid()) { | 209 | if (re.isValid()) { |
205 | search(re); | 210 | search(re); |
206 | } else { | 211 | } else { |
207 | mMatchedEvents.clear(); | 212 | mMatchedEvents.clear(); |
208 | mMatchedTodos.clear(); | 213 | mMatchedTodos.clear(); |
209 | mMatchedJournals.clear(); | 214 | mMatchedJournals.clear(); |
210 | } | 215 | } |
211 | listView->setStartDate( mStartDate->date() ); | 216 | listView->setStartDate( mStartDate->date() ); |
212 | listView->showEvents(mMatchedEvents); | 217 | listView->showEvents(mMatchedEvents); |
213 | listView->addTodos(mMatchedTodos); | 218 | listView->addTodos(mMatchedTodos); |
214 | listView->addJournals(mMatchedJournals); | 219 | listView->addJournals(mMatchedJournals); |
215 | } | 220 | } |
216 | 221 | ||
217 | void SearchDialog::search(const QRegExp &re) | 222 | void SearchDialog::search(const QRegExp &re) |
218 | { | 223 | { |
219 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), | 224 | QPtrList<Event> events = mCalendar->events( mStartDate->date(), |
220 | mEndDate->date(), | 225 | mEndDate->date(), |
221 | false /*mInclusiveCheck->isChecked()*/ ); | 226 | false /*mInclusiveCheck->isChecked()*/ ); |
222 | 227 | ||
223 | mMatchedEvents.clear(); | 228 | mMatchedEvents.clear(); |
224 | if ( mSearchEvent->isChecked() ) { | 229 | if ( mSearchEvent->isChecked() ) { |
225 | Event *ev; | 230 | Event *ev; |
226 | for(ev=events.first();ev;ev=events.next()) { | 231 | for(ev=events.first();ev;ev=events.next()) { |
227 | if (mSummaryCheck->isChecked()) { | 232 | if (mSummaryCheck->isChecked()) { |
228 | #if QT_VERSION >= 0x030000 | 233 | #if QT_VERSION >= 0x030000 |
229 | if (re.search(ev->summary()) != -1) | 234 | if (re.search(ev->summary()) != -1) |
230 | #else | 235 | #else |
231 | if (re.match(ev->summary()) != -1) | 236 | if (re.match(ev->summary()) != -1) |
232 | #endif | 237 | #endif |
233 | { | 238 | { |
234 | mMatchedEvents.append(ev); | 239 | mMatchedEvents.append(ev); |
235 | continue; | 240 | continue; |
236 | } | 241 | } |
237 | #if QT_VERSION >= 0x030000 | 242 | #if QT_VERSION >= 0x030000 |
238 | if (re.search(ev->location()) != -1) | 243 | if (re.search(ev->location()) != -1) |
239 | #else | 244 | #else |
240 | if (re.match(ev->location()) != -1) | 245 | if (re.match(ev->location()) != -1) |
241 | #endif | 246 | #endif |
242 | { | 247 | { |
243 | mMatchedEvents.append(ev); | 248 | mMatchedEvents.append(ev); |
244 | continue; | 249 | continue; |
245 | } | 250 | } |
246 | } | 251 | } |
247 | if (mDescriptionCheck->isChecked()) { | 252 | if (mDescriptionCheck->isChecked()) { |
248 | #if QT_VERSION >= 0x030000 | 253 | #if QT_VERSION >= 0x030000 |
249 | if (re.search(ev->description()) != -1) | 254 | if (re.search(ev->description()) != -1) |
250 | #else | 255 | #else |
251 | if (re.match(ev->description()) != -1) | 256 | if (re.match(ev->description()) != -1) |
252 | #endif | 257 | #endif |
253 | { | 258 | { |
254 | mMatchedEvents.append(ev); | 259 | mMatchedEvents.append(ev); |
255 | continue; | 260 | continue; |
256 | } | 261 | } |
257 | } | 262 | } |
258 | if (mCategoryCheck->isChecked()) { | 263 | if (mCategoryCheck->isChecked()) { |
259 | #if QT_VERSION >= 0x030000 | 264 | #if QT_VERSION >= 0x030000 |
260 | if (re.search(ev->categoriesStr()) != -1) | 265 | if (re.search(ev->categoriesStr()) != -1) |
261 | #else | 266 | #else |
262 | if (re.match(ev->categoriesStr()) != -1) | 267 | if (re.match(ev->categoriesStr()) != -1) |
263 | #endif | 268 | #endif |
264 | { | 269 | { |
265 | mMatchedEvents.append(ev); | 270 | mMatchedEvents.append(ev); |
266 | continue; | 271 | continue; |
267 | } | 272 | } |
268 | } | 273 | } |
269 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 274 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
270 | QPtrList<Attendee> tmpAList = ev->attendees(); | 275 | QPtrList<Attendee> tmpAList = ev->attendees(); |
271 | Attendee *a; | 276 | Attendee *a; |
272 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 277 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
273 | if (mSearchAName->isChecked()) { | 278 | if (mSearchAName->isChecked()) { |
274 | #if QT_VERSION >= 0x030000 | 279 | #if QT_VERSION >= 0x030000 |
275 | if (re.search(a->name()) != -1) | 280 | if (re.search(a->name()) != -1) |
276 | #else | 281 | #else |
277 | if (re.match(a->name()) != -1) | 282 | if (re.match(a->name()) != -1) |
278 | #endif | 283 | #endif |
279 | { | 284 | { |
280 | mMatchedEvents.append(ev); | 285 | mMatchedEvents.append(ev); |
281 | break; | 286 | break; |
282 | } | 287 | } |
283 | } | 288 | } |
284 | if (mSearchAEmail->isChecked()) { | 289 | if (mSearchAEmail->isChecked()) { |
285 | #if QT_VERSION >= 0x030000 | 290 | #if QT_VERSION >= 0x030000 |
286 | if (re.search(a->email()) != -1) | 291 | if (re.search(a->email()) != -1) |
287 | #else | 292 | #else |
288 | if (re.match(a->email()) != -1) | 293 | if (re.match(a->email()) != -1) |
289 | #endif | 294 | #endif |
290 | { | 295 | { |
291 | mMatchedEvents.append(ev); | 296 | mMatchedEvents.append(ev); |
292 | break; | 297 | break; |
293 | } | 298 | } |
294 | } | 299 | } |
295 | } | 300 | } |
296 | } | 301 | } |
297 | } | 302 | } |
298 | } | 303 | } |
299 | QPtrList<Todo> todos = mCalendar->todos( ); | 304 | QPtrList<Todo> todos = mCalendar->todos( ); |
300 | mMatchedTodos.clear(); | 305 | mMatchedTodos.clear(); |
301 | if ( mSearchTodo->isChecked() ) { | 306 | if ( mSearchTodo->isChecked() ) { |
302 | Todo *tod; | 307 | Todo *tod; |
303 | for(tod=todos.first();tod;tod=todos.next()) { | 308 | for(tod=todos.first();tod;tod=todos.next()) { |
304 | if (mSummaryCheck->isChecked()) { | 309 | if (mSummaryCheck->isChecked()) { |
305 | #if QT_VERSION >= 0x030000 | 310 | #if QT_VERSION >= 0x030000 |
306 | if (re.search(tod->summary()) != -1) | 311 | if (re.search(tod->summary()) != -1) |
307 | #else | 312 | #else |
308 | if (re.match(tod->summary()) != -1) | 313 | if (re.match(tod->summary()) != -1) |
309 | #endif | 314 | #endif |
310 | { | 315 | { |
311 | mMatchedTodos.append(tod); | 316 | mMatchedTodos.append(tod); |
312 | continue; | 317 | continue; |
313 | } | 318 | } |
314 | } | 319 | } |
315 | if (mDescriptionCheck->isChecked()) { | 320 | if (mDescriptionCheck->isChecked()) { |
316 | #if QT_VERSION >= 0x030000 | 321 | #if QT_VERSION >= 0x030000 |
317 | if (re.search(tod->description()) != -1) | 322 | if (re.search(tod->description()) != -1) |
318 | #else | 323 | #else |
319 | if (re.match(tod->description()) != -1) | 324 | if (re.match(tod->description()) != -1) |
320 | #endif | 325 | #endif |
321 | { | 326 | { |
322 | mMatchedTodos.append(tod); | 327 | mMatchedTodos.append(tod); |
323 | continue; | 328 | continue; |
324 | } | 329 | } |
325 | } | 330 | } |
326 | if (mCategoryCheck->isChecked()) { | 331 | if (mCategoryCheck->isChecked()) { |
327 | #if QT_VERSION >= 0x030000 | 332 | #if QT_VERSION >= 0x030000 |
328 | if (re.search(tod->categoriesStr()) != -1) | 333 | if (re.search(tod->categoriesStr()) != -1) |
329 | #else | 334 | #else |
330 | if (re.match(tod->categoriesStr()) != -1) | 335 | if (re.match(tod->categoriesStr()) != -1) |
331 | #endif | 336 | #endif |
332 | { | 337 | { |
333 | mMatchedTodos.append(tod); | 338 | mMatchedTodos.append(tod); |
334 | continue; | 339 | continue; |
335 | } | 340 | } |
336 | } | 341 | } |
337 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { | 342 | if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { |
338 | QPtrList<Attendee> tmpAList = tod->attendees(); | 343 | QPtrList<Attendee> tmpAList = tod->attendees(); |
339 | Attendee *a; | 344 | Attendee *a; |
340 | for (a = tmpAList.first(); a; a = tmpAList.next()) { | 345 | for (a = tmpAList.first(); a; a = tmpAList.next()) { |
341 | if (mSearchAName->isChecked()) { | 346 | if (mSearchAName->isChecked()) { |
342 | #if QT_VERSION >= 0x030000 | 347 | #if QT_VERSION >= 0x030000 |
343 | if (re.search(a->name()) != -1) | 348 | if (re.search(a->name()) != -1) |
344 | #else | 349 | #else |
345 | if (re.match(a->name()) != -1) | 350 | if (re.match(a->name()) != -1) |
346 | #endif | 351 | #endif |
347 | { | 352 | { |
348 | mMatchedTodos.append(tod); | 353 | mMatchedTodos.append(tod); |
349 | break; | 354 | break; |
350 | } | 355 | } |
351 | } | 356 | } |
352 | if (mSearchAEmail->isChecked()) { | 357 | if (mSearchAEmail->isChecked()) { |
353 | #if QT_VERSION >= 0x030000 | 358 | #if QT_VERSION >= 0x030000 |
354 | if (re.search(a->email()) != -1) | 359 | if (re.search(a->email()) != -1) |
355 | #else | 360 | #else |
356 | if (re.match(a->email()) != -1) | 361 | if (re.match(a->email()) != -1) |
357 | #endif | 362 | #endif |
358 | { | 363 | { |