-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 21 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 71 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 5 |
3 files changed, 47 insertions, 50 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 965cf47..10d9a8c 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,508 +1,507 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | 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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.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 <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
40 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
41 | #include <kfiledialog.h> | 41 | #include <kfiledialog.h> |
42 | #include <kdialog.h> | 42 | #include <kdialog.h> |
43 | 43 | ||
44 | #include <libkcal/todo.h> | 44 | #include <libkcal/todo.h> |
45 | 45 | ||
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "ktimeedit.h" | 49 | #include "ktimeedit.h" |
50 | 50 | ||
51 | #include "koeditorgeneraltodo.h" | 51 | #include "koeditorgeneraltodo.h" |
52 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
53 | 53 | ||
54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 54 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
55 | const char* name) | 55 | const char* name) |
56 | : KOEditorGeneral( parent, name) | 56 | : KOEditorGeneral( parent, name) |
57 | { | 57 | { |
58 | } | 58 | } |
59 | 59 | ||
60 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 60 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | void KOEditorGeneralTodo::finishSetup() | 64 | void KOEditorGeneralTodo::finishSetup() |
65 | { | 65 | { |
66 | 66 | ||
67 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 67 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
68 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 68 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
69 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 69 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
70 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 70 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
71 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 71 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
72 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 72 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
73 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 73 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
74 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 74 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
75 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 75 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
76 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 76 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
77 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 77 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
78 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 78 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
79 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 79 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 80 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 81 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
82 | mSummaryEdit->setFocus(); | 82 | mSummaryEdit->setFocus(); |
83 | } | 83 | } |
84 | 84 | ||
85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 85 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
86 | { | 86 | { |
87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 87 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
88 | 88 | ||
89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 89 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
90 | i18n("Date && Time"),parent); | 90 | i18n("Date && Time"),parent); |
91 | timeLayout->addWidget(timeGroupBox); | 91 | timeLayout->addWidget(timeGroupBox); |
92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); | 92 | timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 ); |
93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); | 93 | timeGroupBox->layout()->setMargin( KDialog::marginHint() ); |
94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 94 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
95 | 95 | ||
96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 96 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); | 97 | layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); |
98 | layoutTimeBox->setColStretch( 1, 1 ); | 98 | layoutTimeBox->setColStretch( 1, 1 ); |
99 | 99 | ||
100 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | ||
101 | layoutTimeBox->addWidget(mStartCheck,0,0); | ||
102 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | ||
103 | |||
104 | mStartDateEdit = new KDateEdit(timeBoxFrame); | ||
105 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | ||
106 | |||
107 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | ||
108 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | ||
109 | |||
100 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 110 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
101 | layoutTimeBox->addWidget(mDueCheck,1,0); | 111 | layoutTimeBox->addWidget(mDueCheck,1,0); |
102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 112 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
103 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 113 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
104 | 114 | ||
105 | 115 | ||
106 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 116 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
107 | layoutTimeBox->addWidget(mDueDateEdit,1,1); | 117 | layoutTimeBox->addWidget(mDueDateEdit,1,1); |
108 | 118 | ||
109 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 119 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
110 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); | 120 | layoutTimeBox->addWidget(mDueTimeEdit,1,2); |
111 | 121 | ||
112 | 122 | ||
113 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | ||
114 | layoutTimeBox->addWidget(mStartCheck,0,0); | ||
115 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | ||
116 | |||
117 | mStartDateEdit = new KDateEdit(timeBoxFrame); | ||
118 | layoutTimeBox->addWidget(mStartDateEdit,0,1); | ||
119 | |||
120 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | ||
121 | layoutTimeBox->addWidget(mStartTimeEdit,0,2); | ||
122 | |||
123 | |||
124 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
125 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
126 | 125 | ||
127 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
128 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); | 127 | connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); |
129 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); | 128 | connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); |
130 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), | 129 | connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), |
131 | this, SLOT(startDateChanged(QDate))); | 130 | this, SLOT(startDateChanged(QDate))); |
132 | // some more layouting | 131 | // some more layouting |
133 | //layoutTimeBox->setColStretch(3,1); | 132 | //layoutTimeBox->setColStretch(3,1); |
134 | } | 133 | } |
135 | 134 | ||
136 | 135 | ||
137 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 136 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) |
138 | { | 137 | { |
139 | mCompletedCombo = new QComboBox(parent); | 138 | mCompletedCombo = new QComboBox(parent); |
140 | // xgettext:no-c-format | 139 | // xgettext:no-c-format |
141 | mCompletedCombo->insertItem(i18n(" 0 %")); | 140 | mCompletedCombo->insertItem(i18n(" 0 %")); |
142 | // xgettext:no-c-format | 141 | // xgettext:no-c-format |
143 | mCompletedCombo->insertItem(i18n(" 20 %")); | 142 | mCompletedCombo->insertItem(i18n(" 20 %")); |
144 | // xgettext:no-c-format | 143 | // xgettext:no-c-format |
145 | mCompletedCombo->insertItem(i18n(" 40 %")); | 144 | mCompletedCombo->insertItem(i18n(" 40 %")); |
146 | // xgettext:no-c-format | 145 | // xgettext:no-c-format |
147 | mCompletedCombo->insertItem(i18n(" 60 %")); | 146 | mCompletedCombo->insertItem(i18n(" 60 %")); |
148 | // xgettext:no-c-format | 147 | // xgettext:no-c-format |
149 | mCompletedCombo->insertItem(i18n(" 80 %")); | 148 | mCompletedCombo->insertItem(i18n(" 80 %")); |
150 | // xgettext:no-c-format | 149 | // xgettext:no-c-format |
151 | mCompletedCombo->insertItem(i18n("100 %")); | 150 | mCompletedCombo->insertItem(i18n("100 %")); |
152 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 151 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
153 | topLayout->addWidget(mCompletedCombo); | 152 | topLayout->addWidget(mCompletedCombo); |
154 | 153 | ||
155 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 154 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
156 | topLayout->addWidget(mCompletedLabel); | 155 | topLayout->addWidget(mCompletedLabel); |
157 | 156 | ||
158 | mCompleteDateEdit = new KDateEdit(parent); | 157 | mCompleteDateEdit = new KDateEdit(parent); |
159 | topLayout->addWidget(mCompleteDateEdit ); | 158 | topLayout->addWidget(mCompleteDateEdit ); |
160 | 159 | ||
161 | mCompleteTimeEdit = new KOTimeEdit(parent); | 160 | mCompleteTimeEdit = new KOTimeEdit(parent); |
162 | topLayout->addWidget( mCompleteTimeEdit); | 161 | topLayout->addWidget( mCompleteTimeEdit); |
163 | 162 | ||
164 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 163 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
165 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 164 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
166 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); | 165 | connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); |
167 | 166 | ||
168 | if ( QApplication::desktop()->width() <= 480 ) { | 167 | if ( QApplication::desktop()->width() <= 480 ) { |
169 | if ( QApplication::desktop()->width() < 320 ) | 168 | if ( QApplication::desktop()->width() < 320 ) |
170 | mCompleteDateEdit->setMaximumWidth( 85 ); | 169 | mCompleteDateEdit->setMaximumWidth( 85 ); |
171 | else | 170 | else |
172 | mCompleteDateEdit->setMaximumWidth( 140 ); | 171 | mCompleteDateEdit->setMaximumWidth( 140 ); |
173 | topLayout->setSpacing( 0 ); | 172 | topLayout->setSpacing( 0 ); |
174 | } | 173 | } |
175 | } | 174 | } |
176 | 175 | ||
177 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 176 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
178 | { | 177 | { |
179 | 178 | ||
180 | QHBox* h = new QHBox ( parent ); | 179 | QHBox* h = new QHBox ( parent ); |
181 | topLayout->addWidget( h ); | 180 | topLayout->addWidget( h ); |
182 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 181 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
183 | // topLayout->addWidget(priorityLabel); | 182 | // topLayout->addWidget(priorityLabel); |
184 | mPriorityCombo = new QComboBox( h ); | 183 | mPriorityCombo = new QComboBox( h ); |
185 | mPriorityCombo->insertItem(i18n("1 (high)")); | 184 | mPriorityCombo->insertItem(i18n("1 (high)")); |
186 | mPriorityCombo->insertItem(i18n("2")); | 185 | mPriorityCombo->insertItem(i18n("2")); |
187 | mPriorityCombo->insertItem(i18n("3")); | 186 | mPriorityCombo->insertItem(i18n("3")); |
188 | mPriorityCombo->insertItem(i18n("4")); | 187 | mPriorityCombo->insertItem(i18n("4")); |
189 | mPriorityCombo->insertItem(i18n("5 (low)")); | 188 | mPriorityCombo->insertItem(i18n("5 (low)")); |
190 | //topLayout->addWidget(mPriorityCombo); | 189 | //topLayout->addWidget(mPriorityCombo); |
191 | } | 190 | } |
192 | 191 | ||
193 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 192 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
194 | { | 193 | { |
195 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 194 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
196 | 195 | ||
197 | initCompletion( parent, statusLayout ); | 196 | initCompletion( parent, statusLayout ); |
198 | 197 | ||
199 | statusLayout->addStretch( 1 ); | 198 | statusLayout->addStretch( 1 ); |
200 | 199 | ||
201 | initPriority( parent, statusLayout ); | 200 | initPriority( parent, statusLayout ); |
202 | } | 201 | } |
203 | 202 | ||
204 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 203 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
205 | { | 204 | { |
206 | 205 | ||
207 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 206 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
208 | mLocationEdit->load(KOLocationBox::LOCATION); | 207 | mLocationEdit->load(KOLocationBox::LOCATION); |
209 | KOEditorGeneral::setDefaults(allDay); | 208 | KOEditorGeneral::setDefaults(allDay); |
210 | 209 | ||
211 | mTimeButton->setChecked( !allDay ); | 210 | mTimeButton->setChecked( !allDay ); |
212 | if(mTimeButton->isChecked()) { | 211 | if(mTimeButton->isChecked()) { |
213 | mTimeButton->setEnabled(true); | 212 | mTimeButton->setEnabled(true); |
214 | } | 213 | } |
215 | else { | 214 | else { |
216 | mTimeButton->setEnabled(false); | 215 | mTimeButton->setEnabled(false); |
217 | } | 216 | } |
218 | 217 | ||
219 | enableTimeEdits( !allDay ); | 218 | enableTimeEdits( !allDay ); |
220 | if ( due.isValid() ) { | 219 | if ( due.isValid() ) { |
221 | mDueCheck->setChecked(true); | 220 | mDueCheck->setChecked(true); |
222 | enableDueEdit(true); | 221 | enableDueEdit(true); |
223 | alarmDisable(false); | 222 | alarmDisable(false); |
224 | } else { | 223 | } else { |
225 | mDueCheck->setChecked(false); | 224 | mDueCheck->setChecked(false); |
226 | enableDueEdit(false); | 225 | enableDueEdit(false); |
227 | due = QDateTime::currentDateTime().addDays(7); | 226 | due = QDateTime::currentDateTime().addDays(7); |
228 | alarmDisable(true); | 227 | alarmDisable(true); |
229 | } | 228 | } |
230 | 229 | ||
231 | 230 | ||
232 | mStartCheck->setChecked(false); | 231 | mStartCheck->setChecked(false); |
233 | enableStartEdit(false); | 232 | enableStartEdit(false); |
234 | 233 | ||
235 | mDueDateEdit->setDate(due.date()); | 234 | mDueDateEdit->setDate(due.date()); |
236 | mDueTimeEdit->setTime(due.time()); | 235 | mDueTimeEdit->setTime(due.time()); |
237 | due = due.addDays(-7); | 236 | due = due.addDays(-7); |
238 | mStartDateEdit->setDate(due.date()); | 237 | mStartDateEdit->setDate(due.date()); |
239 | mStartTimeEdit->setTime(due.time()); | 238 | mStartTimeEdit->setTime(due.time()); |
240 | 239 | ||
241 | mPriorityCombo->setCurrentItem(2); | 240 | mPriorityCombo->setCurrentItem(2); |
242 | mCompletedLabel->setText(i18n(" completed"));; | 241 | mCompletedLabel->setText(i18n(" completed"));; |
243 | mCompletedCombo->setCurrentItem(0); | 242 | mCompletedCombo->setCurrentItem(0); |
244 | mCompleteDateEdit->hide(); | 243 | mCompleteDateEdit->hide(); |
245 | mCompleteTimeEdit->hide(); | 244 | mCompleteTimeEdit->hide(); |
246 | } | 245 | } |
247 | 246 | ||
248 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 247 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
249 | { | 248 | { |
250 | 249 | ||
251 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 250 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
252 | mLocationEdit->load(KOLocationBox::LOCATION); | 251 | mLocationEdit->load(KOLocationBox::LOCATION); |
253 | KOEditorGeneral::readIncidence(todo); | 252 | KOEditorGeneral::readIncidence(todo); |
254 | 253 | ||
255 | QDateTime dueDT; | 254 | QDateTime dueDT; |
256 | 255 | ||
257 | if (todo->hasDueDate()) { | 256 | if (todo->hasDueDate()) { |
258 | enableAlarmEdit(true); | 257 | enableAlarmEdit(true); |
259 | dueDT = todo->dtDue(); | 258 | dueDT = todo->dtDue(); |
260 | mDueDateEdit->setDate(todo->dtDue().date()); | 259 | mDueDateEdit->setDate(todo->dtDue().date()); |
261 | mDueTimeEdit->setTime(todo->dtDue().time()); | 260 | mDueTimeEdit->setTime(todo->dtDue().time()); |
262 | mDueCheck->setChecked(true); | 261 | mDueCheck->setChecked(true); |
263 | } else { | 262 | } else { |
264 | alarmDisable(true); | 263 | alarmDisable(true); |
265 | mDueDateEdit->setEnabled(false); | 264 | mDueDateEdit->setEnabled(false); |
266 | mDueTimeEdit->setEnabled(false); | 265 | mDueTimeEdit->setEnabled(false); |
267 | mDueDateEdit->setDate(QDate::currentDate()); | 266 | mDueDateEdit->setDate(QDate::currentDate()); |
268 | mDueTimeEdit->setTime(QTime::currentTime()); | 267 | mDueTimeEdit->setTime(QTime::currentTime()); |
269 | mDueCheck->setChecked(false); | 268 | mDueCheck->setChecked(false); |
270 | } | 269 | } |
271 | 270 | ||
272 | if (todo->hasStartDate()) { | 271 | if (todo->hasStartDate()) { |
273 | mStartDateEdit->setDate(todo->dtStart().date()); | 272 | mStartDateEdit->setDate(todo->dtStart().date()); |
274 | mStartTimeEdit->setTime(todo->dtStart().time()); | 273 | mStartTimeEdit->setTime(todo->dtStart().time()); |
275 | mStartCheck->setChecked(true); | 274 | mStartCheck->setChecked(true); |
276 | } else { | 275 | } else { |
277 | mStartDateEdit->setEnabled(false); | 276 | mStartDateEdit->setEnabled(false); |
278 | mStartTimeEdit->setEnabled(false); | 277 | mStartTimeEdit->setEnabled(false); |
279 | mStartDateEdit->setDate(QDate::currentDate()); | 278 | mStartDateEdit->setDate(QDate::currentDate()); |
280 | mStartTimeEdit->setTime(QTime::currentTime()); | 279 | mStartTimeEdit->setTime(QTime::currentTime()); |
281 | mStartCheck->setChecked(false); | 280 | mStartCheck->setChecked(false); |
282 | } | 281 | } |
283 | 282 | ||
284 | mTimeButton->setChecked( !todo->doesFloat() ); | 283 | mTimeButton->setChecked( !todo->doesFloat() ); |
285 | 284 | ||
286 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 285 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
287 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 286 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
288 | mCompleted = todo->completed(); | 287 | mCompleted = todo->completed(); |
289 | } | 288 | } |
290 | setCompletedDate(); | 289 | setCompletedDate(); |
291 | 290 | ||
292 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 291 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
293 | } | 292 | } |
294 | 293 | ||
295 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 294 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
296 | { | 295 | { |
297 | KOEditorGeneral::writeIncidence(todo); | 296 | KOEditorGeneral::writeIncidence(todo); |
298 | 297 | ||
299 | // temp. until something better happens. | 298 | // temp. until something better happens. |
300 | QString tmpStr; | 299 | QString tmpStr; |
301 | 300 | ||
302 | todo->setHasDueDate(mDueCheck->isChecked()); | 301 | todo->setHasDueDate(mDueCheck->isChecked()); |
303 | todo->setHasStartDate(mStartCheck->isChecked()); | 302 | todo->setHasStartDate(mStartCheck->isChecked()); |
304 | 303 | ||
305 | QDate tmpDate; | 304 | QDate tmpDate; |
306 | QTime tmpTime; | 305 | QTime tmpTime; |
307 | QDateTime tmpDT; | 306 | QDateTime tmpDT; |
308 | if ( mTimeButton->isChecked() ) { | 307 | if ( mTimeButton->isChecked() ) { |
309 | todo->setFloats(false); | 308 | todo->setFloats(false); |
310 | 309 | ||
311 | // set due date/time | 310 | // set due date/time |
312 | tmpDate = mDueDateEdit->date(); | 311 | tmpDate = mDueDateEdit->date(); |
313 | tmpTime = mDueTimeEdit->getTime(); | 312 | tmpTime = mDueTimeEdit->getTime(); |
314 | tmpDT.setDate(tmpDate); | 313 | tmpDT.setDate(tmpDate); |
315 | tmpDT.setTime(tmpTime); | 314 | tmpDT.setTime(tmpTime); |
316 | todo->setDtDue(tmpDT); | 315 | todo->setDtDue(tmpDT); |
317 | 316 | ||
318 | // set start date/time | 317 | // set start date/time |
319 | tmpDate = mStartDateEdit->date(); | 318 | tmpDate = mStartDateEdit->date(); |
320 | tmpTime = mStartTimeEdit->getTime(); | 319 | tmpTime = mStartTimeEdit->getTime(); |
321 | tmpDT.setDate(tmpDate); | 320 | tmpDT.setDate(tmpDate); |
322 | tmpDT.setTime(tmpTime); | 321 | tmpDT.setTime(tmpTime); |
323 | todo->setDtStart(tmpDT); | 322 | todo->setDtStart(tmpDT); |
324 | } else { | 323 | } else { |
325 | todo->setFloats(true); | 324 | todo->setFloats(true); |
326 | 325 | ||
327 | // need to change this. | 326 | // need to change this. |
328 | tmpDate = mDueDateEdit->date(); | 327 | tmpDate = mDueDateEdit->date(); |
329 | tmpTime.setHMS(0,0,0); | 328 | tmpTime.setHMS(0,0,0); |
330 | tmpDT.setDate(tmpDate); | 329 | tmpDT.setDate(tmpDate); |
331 | tmpDT.setTime(tmpTime); | 330 | tmpDT.setTime(tmpTime); |
332 | todo->setDtDue(tmpDT); | 331 | todo->setDtDue(tmpDT); |
333 | 332 | ||
334 | tmpDate = mStartDateEdit->date(); | 333 | tmpDate = mStartDateEdit->date(); |
335 | tmpTime.setHMS(0,0,0); | 334 | tmpTime.setHMS(0,0,0); |
336 | tmpDT.setDate(tmpDate); | 335 | tmpDT.setDate(tmpDate); |
337 | tmpDT.setTime(tmpTime); | 336 | tmpDT.setTime(tmpTime); |
338 | todo->setDtStart(tmpDT); | 337 | todo->setDtStart(tmpDT); |
339 | } | 338 | } |
340 | todo->setPriority(mPriorityCombo->currentItem()+1); | 339 | todo->setPriority(mPriorityCombo->currentItem()+1); |
341 | 340 | ||
342 | // set completion state | 341 | // set completion state |
343 | if ( mCompletedCombo->currentItem() == 5 ) { | 342 | if ( mCompletedCombo->currentItem() == 5 ) { |
344 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 343 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
345 | if ( comp.isValid () ) { | 344 | if ( comp.isValid () ) { |
346 | todo->setPercentComplete(100); | 345 | todo->setPercentComplete(100); |
347 | todo->setCompleted(comp); | 346 | todo->setCompleted(comp); |
348 | } else { | 347 | } else { |
349 | todo->setPercentComplete( 100 ); | 348 | todo->setPercentComplete( 100 ); |
350 | if ( mCompleted.isValid() ) | 349 | if ( mCompleted.isValid() ) |
351 | todo->setCompleted(mCompleted); | 350 | todo->setCompleted(mCompleted); |
352 | } | 351 | } |
353 | } else { | 352 | } else { |
354 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 353 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
355 | } | 354 | } |
356 | 355 | ||
357 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 356 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
358 | } | 357 | } |
359 | 358 | ||
360 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 359 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
361 | { | 360 | { |
362 | mDueDateEdit->setEnabled( enable ); | 361 | mDueDateEdit->setEnabled( enable ); |
363 | 362 | ||
364 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 363 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
365 | mTimeButton->setEnabled(true); | 364 | mTimeButton->setEnabled(true); |
366 | } | 365 | } |
367 | else { | 366 | else { |
368 | mTimeButton->setEnabled(false); | 367 | mTimeButton->setEnabled(false); |
369 | mTimeButton->setChecked(false); | 368 | mTimeButton->setChecked(false); |
370 | } | 369 | } |
371 | 370 | ||
372 | if (enable) { | 371 | if (enable) { |
373 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 372 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
374 | } else { | 373 | } else { |
375 | mDueTimeEdit->setEnabled( false ); | 374 | mDueTimeEdit->setEnabled( false ); |
376 | } | 375 | } |
377 | emit datesChecked(); | 376 | emit datesChecked(); |
378 | } | 377 | } |
379 | 378 | ||
380 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 379 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
381 | { | 380 | { |
382 | mStartDateEdit->setEnabled( enable ); | 381 | mStartDateEdit->setEnabled( enable ); |
383 | 382 | ||
384 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 383 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
385 | mTimeButton->setEnabled(true); | 384 | mTimeButton->setEnabled(true); |
386 | } | 385 | } |
387 | else { | 386 | else { |
388 | mTimeButton->setEnabled(false); | 387 | mTimeButton->setEnabled(false); |
389 | mTimeButton->setChecked(false); | 388 | mTimeButton->setChecked(false); |
390 | } | 389 | } |
391 | 390 | ||
392 | if (enable) { | 391 | if (enable) { |
393 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 392 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
394 | } else { | 393 | } else { |
395 | mStartTimeEdit->setEnabled( false ); | 394 | mStartTimeEdit->setEnabled( false ); |
396 | } | 395 | } |
397 | emit datesChecked(); | 396 | emit datesChecked(); |
398 | } | 397 | } |
399 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) | 398 | void KOEditorGeneralTodo::startDateChanged(QDate newdate) |
400 | { | 399 | { |
401 | if ( mDueCheck->isChecked() ) | 400 | if ( mDueCheck->isChecked() ) |
402 | emit dateTimesChanged(newdate,mDueDateEdit->date()); | 401 | emit dateTimesChanged(newdate,mDueDateEdit->date()); |
403 | } | 402 | } |
404 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 403 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
405 | { | 404 | { |
406 | if(mStartCheck->isChecked()) { | 405 | if(mStartCheck->isChecked()) { |
407 | mStartTimeEdit->setEnabled( enable ); | 406 | mStartTimeEdit->setEnabled( enable ); |
408 | } | 407 | } |
409 | if(mDueCheck->isChecked()) { | 408 | if(mDueCheck->isChecked()) { |
410 | mDueTimeEdit->setEnabled( enable ); | 409 | mDueTimeEdit->setEnabled( enable ); |
411 | } | 410 | } |
412 | } | 411 | } |
413 | 412 | ||
414 | void KOEditorGeneralTodo::showAlarm() | 413 | void KOEditorGeneralTodo::showAlarm() |
415 | { | 414 | { |
416 | if ( mDueCheck->isChecked() ) { | 415 | if ( mDueCheck->isChecked() ) { |
417 | alarmDisable(false); | 416 | alarmDisable(false); |
418 | } | 417 | } |
419 | else { | 418 | else { |
420 | alarmDisable(true); | 419 | alarmDisable(true); |
421 | } | 420 | } |
422 | } | 421 | } |
423 | 422 | ||
424 | bool KOEditorGeneralTodo::validateInput() | 423 | bool KOEditorGeneralTodo::validateInput() |
425 | { | 424 | { |
426 | if (mDueCheck->isChecked()) { | 425 | if (mDueCheck->isChecked()) { |
427 | if (!mDueDateEdit->inputIsValid()) { | 426 | if (!mDueDateEdit->inputIsValid()) { |
428 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 427 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
429 | return false; | 428 | return false; |
430 | } | 429 | } |
431 | } | 430 | } |
432 | 431 | ||
433 | if (mStartCheck->isChecked()) { | 432 | if (mStartCheck->isChecked()) { |
434 | if (!mStartDateEdit->inputIsValid()) { | 433 | if (!mStartDateEdit->inputIsValid()) { |
435 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 434 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
436 | return false; | 435 | return false; |
437 | } | 436 | } |
438 | } | 437 | } |
439 | 438 | ||
440 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 439 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
441 | QDateTime startDate; | 440 | QDateTime startDate; |
442 | QDateTime dueDate; | 441 | QDateTime dueDate; |
443 | startDate.setDate(mStartDateEdit->date()); | 442 | startDate.setDate(mStartDateEdit->date()); |
444 | dueDate.setDate(mDueDateEdit->date()); | 443 | dueDate.setDate(mDueDateEdit->date()); |
445 | if (mTimeButton->isChecked()) { | 444 | if (mTimeButton->isChecked()) { |
446 | startDate.setTime(mStartTimeEdit->getTime()); | 445 | startDate.setTime(mStartTimeEdit->getTime()); |
447 | dueDate.setTime(mDueTimeEdit->getTime()); | 446 | dueDate.setTime(mDueTimeEdit->getTime()); |
448 | } | 447 | } |
449 | if (startDate > dueDate) { | 448 | if (startDate > dueDate) { |
450 | KMessageBox::sorry(0, | 449 | KMessageBox::sorry(0, |
451 | i18n("The start date cannot be after the due date.")); | 450 | i18n("The start date cannot be after the due date.")); |
452 | return false; | 451 | return false; |
453 | } | 452 | } |
454 | } | 453 | } |
455 | 454 | ||
456 | return KOEditorGeneral::validateInput(); | 455 | return KOEditorGeneral::validateInput(); |
457 | } | 456 | } |
458 | 457 | ||
459 | void KOEditorGeneralTodo::completedChanged(int index) | 458 | void KOEditorGeneralTodo::completedChanged(int index) |
460 | { | 459 | { |
461 | if (index == 5) { | 460 | if (index == 5) { |
462 | //get rid of milli sec | 461 | //get rid of milli sec |
463 | mCompleted = QDateTime::currentDateTime(); | 462 | mCompleted = QDateTime::currentDateTime(); |
464 | } | 463 | } |
465 | setCompletedDate(); | 464 | setCompletedDate(); |
466 | } | 465 | } |
467 | 466 | ||
468 | void KOEditorGeneralTodo::setCompletedDate() | 467 | void KOEditorGeneralTodo::setCompletedDate() |
469 | { | 468 | { |
470 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 469 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
471 | if ( QApplication::desktop()->width() < 480 ) { | 470 | if ( QApplication::desktop()->width() < 480 ) { |
472 | mCompletedLabel->setText(i18n(" on")); | 471 | mCompletedLabel->setText(i18n(" on")); |
473 | } | 472 | } |
474 | else | 473 | else |
475 | mCompletedLabel->setText(i18n(" completed on ")); | 474 | mCompletedLabel->setText(i18n(" completed on ")); |
476 | mCompleteDateEdit->show(); | 475 | mCompleteDateEdit->show(); |
477 | mCompleteTimeEdit->show(); | 476 | mCompleteTimeEdit->show(); |
478 | mCompleteTimeEdit->setTime( mCompleted.time() ); | 477 | mCompleteTimeEdit->setTime( mCompleted.time() ); |
479 | mCompleteDateEdit->setDate( mCompleted.date() ); | 478 | mCompleteDateEdit->setDate( mCompleted.date() ); |
480 | } else { | 479 | } else { |
481 | mCompletedLabel->setText(i18n(" completed")); | 480 | mCompletedLabel->setText(i18n(" completed")); |
482 | mCompleteDateEdit->hide(); | 481 | mCompleteDateEdit->hide(); |
483 | mCompleteTimeEdit->hide(); | 482 | mCompleteTimeEdit->hide(); |
484 | } | 483 | } |
485 | } | 484 | } |
486 | 485 | ||
487 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) | 486 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) |
488 | { | 487 | { |
489 | switch (modification) { | 488 | switch (modification) { |
490 | case KOGlobals::PRIORITY_MODIFIED: | 489 | case KOGlobals::PRIORITY_MODIFIED: |
491 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 490 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
492 | break; | 491 | break; |
493 | case KOGlobals::COMPLETION_MODIFIED: | 492 | case KOGlobals::COMPLETION_MODIFIED: |
494 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 493 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
495 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 494 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
496 | mCompleted = todo->completed(); | 495 | mCompleted = todo->completed(); |
497 | } | 496 | } |
498 | setCompletedDate(); | 497 | setCompletedDate(); |
499 | break; | 498 | break; |
500 | case KOGlobals::CATEGORY_MODIFIED: | 499 | case KOGlobals::CATEGORY_MODIFIED: |
501 | setCategories (todo->categoriesStr ()); | 500 | setCategories (todo->categoriesStr ()); |
502 | break; | 501 | break; |
503 | case KOGlobals::UNKNOWN_MODIFIED: // fall through | 502 | case KOGlobals::UNKNOWN_MODIFIED: // fall through |
504 | default: | 503 | default: |
505 | readTodo( todo ); | 504 | readTodo( todo ); |
506 | break; | 505 | break; |
507 | } | 506 | } |
508 | } | 507 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e7a5e0e..e560ce4 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,1328 +1,1323 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 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 <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qpaintdevicemetrics.h> | 38 | #include <qpaintdevicemetrics.h> |
39 | 39 | ||
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | 44 | ||
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | #include <libkcal/calendar.h> | 46 | #include <libkcal/calendar.h> |
47 | #include <libkcal/calendarlocal.h> | 47 | #include <libkcal/calendarlocal.h> |
48 | #include <libkcal/icalformat.h> | 48 | #include <libkcal/icalformat.h> |
49 | #include <libkcal/vcalformat.h> | 49 | #include <libkcal/vcalformat.h> |
50 | #include <libkcal/recurrence.h> | 50 | #include <libkcal/recurrence.h> |
51 | #include <libkcal/filestorage.h> | 51 | #include <libkcal/filestorage.h> |
52 | #include <libkdepim/categoryselectdialog.h> | 52 | #include <libkdepim/categoryselectdialog.h> |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #else | 56 | #else |
57 | #include <qapplication.h> | 57 | #include <qapplication.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef KORG_NOPRINTER | 60 | #ifndef KORG_NOPRINTER |
61 | #include "calprinter.h" | 61 | #include "calprinter.h" |
62 | #endif | 62 | #endif |
63 | #include "koglobals.h" | 63 | #include "koglobals.h" |
64 | #include "koprefs.h" | 64 | #include "koprefs.h" |
65 | #include "kfiledialog.h" | 65 | #include "kfiledialog.h" |
66 | 66 | ||
67 | #include "kolistview.h" | 67 | #include "kolistview.h" |
68 | #include "koeventviewer.h" | 68 | #include "koeventviewer.h" |
69 | 69 | ||
70 | extern QPixmap* sgListViewCompletedPix[6]; | 70 | extern QPixmap* sgListViewCompletedPix[6]; |
71 | extern QPixmap* sgListViewJournalPix; | 71 | extern QPixmap* sgListViewJournalPix; |
72 | 72 | ||
73 | class KOListViewWhatsThis :public QWhatsThis | 73 | class KOListViewWhatsThis :public QWhatsThis |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | virtual QString text( const QPoint& p) | 79 | virtual QString text( const QPoint& p) |
80 | { | 80 | { |
81 | return _view->getWhatsThisText(p) ; | 81 | return _view->getWhatsThisText(p) ; |
82 | } | 82 | } |
83 | private: | 83 | private: |
84 | QWidget* _wid; | 84 | QWidget* _wid; |
85 | KOListView * _view; | 85 | KOListView * _view; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
90 | { | 90 | { |
91 | mItem = item; | 91 | mItem = item; |
92 | mDate = date; | 92 | mDate = date; |
93 | } | 93 | } |
94 | 94 | ||
95 | ListItemVisitor::~ListItemVisitor() | 95 | ListItemVisitor::~ListItemVisitor() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | bool ListItemVisitor::visit(Event *e) | 99 | bool ListItemVisitor::visit(Event *e) |
100 | { | 100 | { |
101 | bool ok = false; | 101 | bool ok = false; |
102 | QString start, end; | 102 | QString start, end; |
103 | QDate ds, de; | 103 | QDate ds, de; |
104 | if ( e->doesRecur() ) { | 104 | if ( e->doesRecur() ) { |
105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
106 | if ( ok ) { | 106 | if ( ok ) { |
107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
108 | start = KGlobal::locale()->formatDate(ds,true); | 108 | start = KGlobal::locale()->formatDate(ds,true); |
109 | de = ds.addDays( days); | 109 | de = ds.addDays( days); |
110 | end = KGlobal::locale()->formatDate(de,true); | 110 | end = KGlobal::locale()->formatDate(de,true); |
111 | } | 111 | } |
112 | 112 | ||
113 | } | 113 | } |
114 | if ( ! ok ) { | 114 | if ( ! ok ) { |
115 | start =e->dtStartDateStr(); | 115 | start =e->dtStartDateStr(); |
116 | end = e->dtEndDateStr(); | 116 | end = e->dtEndDateStr(); |
117 | ds = e->dtStart().date(); | 117 | ds = e->dtStart().date(); |
118 | de = e->dtEnd().date(); | 118 | de = e->dtEnd().date(); |
119 | } | 119 | } |
120 | mItem->setText(0,e->summary()); | 120 | mItem->setText(0,e->summary()); |
121 | mItem->setText(1,start); | 121 | mItem->setText(1,start); |
122 | if ( e->doesFloat() ) | 122 | if ( e->doesFloat() ) |
123 | mItem->setText(2,"---"); | 123 | mItem->setText(2,"---"); |
124 | else | 124 | else |
125 | mItem->setText(2,e->dtStartTimeStr()); | 125 | mItem->setText(2,e->dtStartTimeStr()); |
126 | mItem->setText(3,end); | 126 | mItem->setText(3,end); |
127 | if ( e->doesFloat() ) | 127 | if ( e->doesFloat() ) |
128 | mItem->setText(4,"---"); | 128 | mItem->setText(4,"---"); |
129 | else | 129 | else |
130 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
131 | mItem->setText(5, e->durationText()); | ||
131 | if ( e->isAlarmEnabled() ) { | 132 | if ( e->isAlarmEnabled() ) { |
132 | mItem->setText(5,e->alarms().first()->offsetText() ); | 133 | mItem->setText(6,e->alarms().first()->offsetText() ); |
133 | } else { | 134 | } else { |
134 | mItem->setText(5, i18n("No")); | 135 | mItem->setText(6, i18n("No")); |
135 | } | 136 | } |
136 | mItem->setText(6, e->recurrenceText()); | 137 | mItem->setText(7, e->recurrenceText()); |
137 | if( ! e->doesRecur() ) | 138 | if( ! e->doesRecur() ) |
138 | mItem->setSortKey( 6, "-" ); | 139 | mItem->setSortKey( 7, "-" ); |
139 | mItem->setText(7,"---"); | 140 | mItem->setText(8, e->cancelled() ? i18n("Yes") : i18n("No")); |
140 | mItem->setText(8,"---"); | 141 | mItem->setText(9,e->categoriesStr()); |
141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 142 | mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); |
142 | mItem->setText(10,e->categoriesStr()); | 143 | mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); |
143 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | ||
144 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | ||
145 | 144 | ||
146 | QString key; | 145 | QString key; |
147 | QDate d = e->lastModified().date(); | 146 | QDate d = e->lastModified().date(); |
148 | QTime t = e->lastModified().time(); | 147 | QTime t = e->lastModified().time(); |
149 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | 148 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); |
150 | mItem->setSortKey(12,key); | 149 | mItem->setSortKey(12,key); |
151 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 150 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
152 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 151 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
153 | mItem->setSortKey(1,key); | 152 | mItem->setSortKey(1,key); |
154 | 153 | ||
155 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 154 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
156 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 155 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
157 | mItem->setSortKey(3,key); | 156 | mItem->setSortKey(3,key); |
158 | return true; | 157 | return true; |
159 | } | 158 | } |
160 | 159 | ||
161 | bool ListItemVisitor::visit(Todo *t) | 160 | bool ListItemVisitor::visit(Todo *t) |
162 | { | 161 | { |
163 | mItem->setText(0,t->summary()); | 162 | mItem->setText(0,t->summary()); |
164 | if ( t->isCompleted() ) { | 163 | if ( t->isCompleted() ) { |
165 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | 164 | mItem->setSortKey(0,"99"+ t->summary().left(10)); |
166 | } else | 165 | } else |
167 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); | 166 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); |
168 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); | 167 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); |
169 | if (t->hasStartDate()) { | 168 | if (t->hasStartDate()) { |
170 | mItem->setText(1,t->dtStartDateStr()); | 169 | mItem->setText(1,t->dtStartDateStr()); |
171 | if (t->doesFloat()) { | 170 | if (t->doesFloat()) { |
172 | mItem->setText(2,"---"); | 171 | mItem->setText(2,"---"); |
173 | } else { | 172 | } else { |
174 | mItem->setText(2,t->dtStartTimeStr()); | 173 | mItem->setText(2,t->dtStartTimeStr()); |
175 | } | 174 | } |
176 | } else { | 175 | } else { |
177 | mItem->setText(1,"---"); | 176 | mItem->setText(1,"---"); |
178 | mItem->setText(2,"---"); | 177 | mItem->setText(2,"---"); |
179 | } | 178 | } |
180 | mItem->setText(3,"---"); | ||
181 | mItem->setText(4,"---"); | ||
182 | if ( t->isAlarmEnabled() ) { | 179 | if ( t->isAlarmEnabled() ) { |
183 | mItem->setText(5,t->alarms().first()->offsetText() ); | 180 | mItem->setText(6,t->alarms().first()->offsetText() ); |
184 | } else { | 181 | } else { |
185 | mItem->setText(5, i18n("No")); | 182 | mItem->setText(6, i18n("No")); |
186 | } | 183 | } |
187 | mItem->setText(6, t->recurrenceText()); | 184 | mItem->setText(7, t->recurrenceText()); |
188 | if( ! t->doesRecur() ) | 185 | if( ! t->doesRecur() ) |
189 | mItem->setSortKey( 6, "-" ); | 186 | mItem->setSortKey( 7, "-" ); |
190 | if (t->hasDueDate()) { | 187 | if (t->hasDueDate()) { |
191 | mItem->setText(7,t->dtDueDateStr()); | 188 | mItem->setText(3,t->dtDueDateStr()); |
192 | if (t->doesFloat()) { | 189 | if (t->doesFloat()) { |
193 | mItem->setText(8,"---"); | 190 | mItem->setText(4,"---"); |
194 | } else { | 191 | } else { |
195 | mItem->setText(8,t->dtDueTimeStr()); | 192 | mItem->setText(4,t->dtDueTimeStr()); |
196 | } | 193 | } |
197 | } else { | 194 | } else { |
198 | mItem->setText(7,"---"); | 195 | mItem->setText(3,"---"); |
199 | mItem->setText(8,"---"); | 196 | mItem->setText(4,"---"); |
200 | } | 197 | } |
201 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 198 | mItem->setText(5, t->durationText()); |
202 | mItem->setText(10,t->categoriesStr()); | 199 | mItem->setText(8, t->cancelled() ? i18n("Yes") : i18n("No")); |
203 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 200 | mItem->setText(9,t->categoriesStr()); |
204 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | 201 | mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); |
202 | mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | ||
205 | QString key; | 203 | QString key; |
206 | QDate d = t->lastModified().date(); | 204 | QDate d = t->lastModified().date(); |
207 | QTime tm = t->lastModified().time(); | 205 | QTime tm = t->lastModified().time(); |
208 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | 206 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); |
209 | mItem->setSortKey(12,key); | 207 | mItem->setSortKey(11,key); |
210 | if (t->hasDueDate()) { | 208 | if (t->hasDueDate()) { |
211 | d = t->dtDue().date(); | 209 | d = t->dtDue().date(); |
212 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 210 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
213 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 211 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
214 | mItem->setSortKey(7,key); | 212 | mItem->setSortKey(3,key); |
215 | } | 213 | } |
216 | if ( t->hasStartDate() ) { | 214 | if ( t->hasStartDate() ) { |
217 | d = t->dtStart().date(); | 215 | d = t->dtStart().date(); |
218 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 216 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
219 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 217 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
220 | mItem->setSortKey(1,key); | 218 | mItem->setSortKey(1,key); |
221 | } | 219 | } |
222 | return true; | 220 | return true; |
223 | } | 221 | } |
224 | 222 | ||
225 | bool ListItemVisitor::visit(Journal * j) | 223 | bool ListItemVisitor::visit(Journal * j) |
226 | { | 224 | { |
227 | 225 | ||
228 | QString des; | 226 | QString des; |
229 | mItem->setPixmap( 0, *sgListViewJournalPix); | 227 | mItem->setPixmap( 0, *sgListViewJournalPix); |
230 | if ( !j->summary().isEmpty() ) { | 228 | if ( !j->summary().isEmpty() ) { |
231 | des = j->summary(); | 229 | des = j->summary(); |
232 | } else { | 230 | } else { |
233 | des = j->description().left(30); | 231 | des = j->description().left(30); |
234 | des = des.simplifyWhiteSpace (); | 232 | des = des.simplifyWhiteSpace (); |
235 | des.replace (QRegExp ("\\n"),"" ); | 233 | des.replace (QRegExp ("\\n"),"" ); |
236 | des.replace (QRegExp ("\\r"),"" ); | 234 | des.replace (QRegExp ("\\r"),"" ); |
237 | } | 235 | } |
238 | mItem->setText(0,des.left(25)); | 236 | mItem->setText(0,des.left(25)); |
239 | mItem->setSortKey(0,"0"+ des.left(25)); | 237 | mItem->setSortKey(0,"0"+ des.left(25)); |
240 | mItem->setText(1,j->dtStartDateStr()); | 238 | mItem->setText(1,j->dtStartDateStr()); |
241 | mItem->setText(2,"---"); | 239 | mItem->setText(2,"---"); |
242 | mItem->setText(3,"---"); | 240 | mItem->setText(3,"---"); |
243 | mItem->setText(4,"---"); | 241 | mItem->setText(4,"---"); |
244 | mItem->setText(5,"---"); | 242 | mItem->setText(5,"---"); |
245 | mItem->setText(6,"---"); | 243 | mItem->setText(6,"---"); |
246 | mItem->setText(7,j->dtStartDateStr()); | 244 | mItem->setText(7,"---"); |
247 | mItem->setText(8,"---"); | 245 | mItem->setText(8,"---"); |
248 | mItem->setText(9,"---"); | 246 | mItem->setText(9,j->categoriesStr()); |
249 | mItem->setText(10,j->categoriesStr()); | 247 | mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); |
250 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 248 | mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); |
251 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | ||
252 | 249 | ||
253 | QString key; | 250 | QString key; |
254 | QDate d = j->lastModified().date(); | 251 | QDate d = j->lastModified().date(); |
255 | QTime tm = j->lastModified().time(); | 252 | QTime tm = j->lastModified().time(); |
256 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | 253 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); |
257 | mItem->setSortKey(12,key); | 254 | mItem->setSortKey(12,key); |
258 | d = j->dtStart().date(); | 255 | d = j->dtStart().date(); |
259 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 256 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
260 | mItem->setSortKey(1,key); | 257 | mItem->setSortKey(1,key); |
261 | mItem->setSortKey(7,key); | 258 | mItem->setSortKey(7,key); |
262 | 259 | ||
263 | return true; | 260 | return true; |
264 | } | 261 | } |
265 | 262 | ||
266 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 263 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
267 | const char *name) | 264 | const char *name) |
268 | : KOEventView(calendar, parent, name) | 265 | : KOEventView(calendar, parent, name) |
269 | { | 266 | { |
270 | 267 | ||
271 | mActiveItem = 0; | 268 | mActiveItem = 0; |
272 | mForceShowCompletedTodos = false; | 269 | mForceShowCompletedTodos = false; |
273 | mListView = new KOListViewListView(this); | 270 | mListView = new KOListViewListView(this); |
274 | mListView->addColumn(i18n("Summary")); | 271 | mListView->addColumn(i18n("Summary")); |
275 | mListView->addColumn(i18n("Start Date")); | 272 | mListView->addColumn(i18n("Start Date")); |
276 | mListView->addColumn(i18n("Start Time")); | 273 | mListView->addColumn(i18n("Start Time")); |
277 | mListView->addColumn(i18n("End Date")); | 274 | mListView->addColumn(i18n("End/Due Date")); |
278 | mListView->addColumn(i18n("End Time")); | 275 | mListView->addColumn(i18n("End/Due Time")); |
276 | mListView->addColumn(i18n("Duration")); | ||
279 | mListView->addColumn(i18n("Alarm")); // alarm set? | 277 | mListView->addColumn(i18n("Alarm")); // alarm set? |
280 | mListView->addColumn(i18n("Recurs")); // recurs? | 278 | mListView->addColumn(i18n("Recurs")); // recurs? |
281 | mListView->addColumn(i18n("Due Date")); | ||
282 | mListView->addColumn(i18n("Due Time")); | ||
283 | mListView->addColumn(i18n("Cancelled")); | 279 | mListView->addColumn(i18n("Cancelled")); |
284 | mListView->addColumn(i18n("Categories")); | 280 | mListView->addColumn(i18n("Categories")); |
285 | mListView->addColumn(i18n("Calendar")); | 281 | mListView->addColumn(i18n("Calendar")); |
286 | mListView->addColumn(i18n("Last Modified")); | 282 | mListView->addColumn(i18n("Last Modified")); |
287 | 283 | ||
288 | mListView->setColumnAlignment(0,AlignLeft); | 284 | mListView->setColumnAlignment(0,AlignLeft); |
289 | mListView->setColumnAlignment(1,AlignLeft); | 285 | mListView->setColumnAlignment(1,AlignLeft); |
290 | mListView->setColumnAlignment(2,AlignHCenter); | 286 | mListView->setColumnAlignment(2,AlignHCenter); |
291 | mListView->setColumnAlignment(3,AlignLeft); | 287 | mListView->setColumnAlignment(3,AlignLeft); |
292 | mListView->setColumnAlignment(4,AlignHCenter); | 288 | mListView->setColumnAlignment(4,AlignHCenter); |
293 | mListView->setColumnAlignment(5,AlignLeft); | 289 | mListView->setColumnAlignment(5,AlignLeft); |
294 | mListView->setColumnAlignment(6,AlignLeft); | 290 | mListView->setColumnAlignment(6,AlignLeft); |
295 | mListView->setColumnAlignment(7,AlignLeft); | 291 | mListView->setColumnAlignment(7,AlignLeft); |
296 | mListView->setColumnAlignment(8,AlignLeft); | 292 | mListView->setColumnAlignment(8,AlignLeft); |
297 | mListView->setColumnAlignment(9,AlignLeft); | 293 | mListView->setColumnAlignment(9,AlignLeft); |
298 | mListView->setColumnAlignment(10,AlignLeft); | 294 | mListView->setColumnAlignment(10,AlignLeft); |
299 | mListView->setColumnAlignment(11,AlignLeft); | 295 | mListView->setColumnAlignment(11,AlignLeft); |
300 | mListView->setColumnAlignment(12,AlignLeft); | ||
301 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 296 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
302 | 297 | ||
303 | int iii = 0; | 298 | int iii = 0; |
304 | for ( iii = 0; iii< 13 ; ++iii ) | 299 | for ( iii = 0; iii< 12 ; ++iii ) |
305 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 300 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
306 | 301 | ||
307 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 302 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
308 | layoutTop->addWidget(mListView); | 303 | layoutTop->addWidget(mListView); |
309 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 304 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
310 | mPopupMenu = eventPopup(); | 305 | mPopupMenu = eventPopup(); |
311 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 306 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
312 | mPopupMenu->insertSeparator(); | 307 | mPopupMenu->insertSeparator(); |
313 | 308 | ||
314 | selPopup->insertItem(i18n("All"),this, | 309 | selPopup->insertItem(i18n("All"),this, |
315 | SLOT(allSelection())); | 310 | SLOT(allSelection())); |
316 | selPopup->insertItem(i18n("None"),this, | 311 | selPopup->insertItem(i18n("None"),this, |
317 | SLOT(clearSelection())); | 312 | SLOT(clearSelection())); |
318 | selPopup->insertItem(i18n("Delete selected..."),this, | 313 | selPopup->insertItem(i18n("Delete selected..."),this, |
319 | SLOT(deleteAll())); | 314 | SLOT(deleteAll())); |
320 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 315 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
321 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 316 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
322 | i18n("Hide all selected"),this, | 317 | i18n("Hide all selected"),this, |
323 | SLOT(hideAll()),true); | 318 | SLOT(hideAll()),true); |
324 | 319 | ||
325 | selPopup->insertSeparator(); | 320 | selPopup->insertSeparator(); |
326 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 321 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
327 | selPopup->insertItem( i18n("Export"), exportPO ); | 322 | selPopup->insertItem( i18n("Export"), exportPO ); |
328 | #ifdef DESKTOP_VERSION | 323 | #ifdef DESKTOP_VERSION |
329 | mPopupMenu->insertSeparator(); | 324 | mPopupMenu->insertSeparator(); |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 325 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
331 | i18n("Print complete list..."),this, | 326 | i18n("Print complete list..."),this, |
332 | SLOT(printList()),true); | 327 | SLOT(printList()),true); |
333 | #endif | 328 | #endif |
334 | mCalPopup = new QPopupMenu ( this ); | 329 | mCalPopup = new QPopupMenu ( this ); |
335 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 330 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
336 | 331 | ||
337 | selPopup->insertItem(i18n("Set categories")+"...",this, | 332 | selPopup->insertItem(i18n("Set categories")+"...",this, |
338 | SLOT(setCat()) ); | 333 | SLOT(setCat()) ); |
339 | selPopup->insertItem( i18n("Set alarm..."),this, | 334 | selPopup->insertItem( i18n("Set alarm..."),this, |
340 | SLOT(setAlarm())); | 335 | SLOT(setAlarm())); |
341 | #if 0 | 336 | #if 0 |
342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 337 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
343 | i18n("Set categories")+"...",this, | 338 | i18n("Set categories")+"...",this, |
344 | SLOT(setCat()),true); | 339 | SLOT(setCat()),true); |
345 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 340 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
346 | i18n("Set alarm..."),this, | 341 | i18n("Set alarm..."),this, |
347 | SLOT(setAlarm()),true); | 342 | SLOT(setAlarm()),true); |
348 | #endif | 343 | #endif |
349 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 344 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
350 | SLOT( populateCalPopup() )); | 345 | SLOT( populateCalPopup() )); |
351 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 346 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
352 | SLOT( setCalendar( int ) )); | 347 | SLOT( setCalendar( int ) )); |
353 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 348 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
354 | SLOT( catChanged( Incidence * ) )); | 349 | SLOT( catChanged( Incidence * ) )); |
355 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 350 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
356 | SLOT(saveToFile())); | 351 | SLOT(saveToFile())); |
357 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 352 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
358 | SLOT(saveToFileVCS())); | 353 | SLOT(saveToFileVCS())); |
359 | exportPO->insertItem( i18n("Journal/Details..."),this, | 354 | exportPO->insertItem( i18n("Journal/Details..."),this, |
360 | SLOT(saveDescriptionToFile())); | 355 | SLOT(saveDescriptionToFile())); |
361 | // mPopupMenu->insertSeparator(); | 356 | // mPopupMenu->insertSeparator(); |
362 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 357 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
363 | // i18n("Add Categ. to selected..."),this, | 358 | // i18n("Add Categ. to selected..."),this, |
364 | // SLOT(addCat()),true); | 359 | // SLOT(addCat()),true); |
365 | //mPopupMenu->insertSeparator(); | 360 | //mPopupMenu->insertSeparator(); |
366 | #ifndef DESKTOP_VERSION | 361 | #ifndef DESKTOP_VERSION |
367 | selPopup->insertSeparator(); | 362 | selPopup->insertSeparator(); |
368 | selPopup->insertItem( i18n("Beam via IR..."),this, | 363 | selPopup->insertItem( i18n("Beam via IR..."),this, |
369 | SLOT(beamSelected())); | 364 | SLOT(beamSelected())); |
370 | #if 0 | 365 | #if 0 |
371 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 366 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
372 | i18n("Beam via IR"),this, | 367 | i18n("Beam via IR"),this, |
373 | SLOT(beamSelected()),true); | 368 | SLOT(beamSelected()),true); |
374 | #endif | 369 | #endif |
375 | #endif | 370 | #endif |
376 | /* | 371 | /* |
377 | mPopupMenu = new QPopupMenu; | 372 | mPopupMenu = new QPopupMenu; |
378 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 373 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
379 | SLOT (editEvent())); | 374 | SLOT (editEvent())); |
380 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 375 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
381 | SLOT (deleteEvent())); | 376 | SLOT (deleteEvent())); |
382 | mPopupMenu->insertSeparator(); | 377 | mPopupMenu->insertSeparator(); |
383 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 378 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
384 | SLOT(showDates())); | 379 | SLOT(showDates())); |
385 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 380 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
386 | SLOT(hideDates())); | 381 | SLOT(hideDates())); |
387 | */ | 382 | */ |
388 | QObject::connect(mListView,SIGNAL( newEvent()), | 383 | QObject::connect(mListView,SIGNAL( newEvent()), |
389 | this,SIGNAL(signalNewEvent())); | 384 | this,SIGNAL(signalNewEvent())); |
390 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 385 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
391 | this,SLOT(defaultItemAction(QListViewItem *))); | 386 | this,SLOT(defaultItemAction(QListViewItem *))); |
392 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 387 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
393 | const QPoint &, int )), | 388 | const QPoint &, int )), |
394 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 389 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
395 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 390 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
396 | SLOT(processSelectionChange(QListViewItem *))); | 391 | SLOT(processSelectionChange(QListViewItem *))); |
397 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 392 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
398 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 393 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
399 | 394 | ||
400 | readSettings(KOGlobals::config(),"KOListView Layout"); | 395 | readSettings(KOGlobals::config(),"KOListView Layout"); |
401 | } | 396 | } |
402 | 397 | ||
403 | KOListView::~KOListView() | 398 | KOListView::~KOListView() |
404 | { | 399 | { |
405 | delete mPopupMenu; | 400 | delete mPopupMenu; |
406 | #if QT_VERSION >= 0x030000 | 401 | #if QT_VERSION >= 0x030000 |
407 | 402 | ||
408 | #else | 403 | #else |
409 | delete mKOListViewWhatsThis; | 404 | delete mKOListViewWhatsThis; |
410 | #endif | 405 | #endif |
411 | } | 406 | } |
412 | 407 | ||
413 | void KOListView::catChanged( Incidence* inc) | 408 | void KOListView::catChanged( Incidence* inc) |
414 | { | 409 | { |
415 | KOListViewItem* item = getItemForEvent(inc); | 410 | KOListViewItem* item = getItemForEvent(inc); |
416 | if (item) { | 411 | if (item) { |
417 | ListItemVisitor v(item, mStartDate ); | 412 | ListItemVisitor v(item, mStartDate ); |
418 | inc->accept(v); | 413 | inc->accept(v); |
419 | } | 414 | } |
420 | } | 415 | } |
421 | QString KOListView::getWhatsThisText(QPoint p) | 416 | QString KOListView::getWhatsThisText(QPoint p) |
422 | { | 417 | { |
423 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 418 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
424 | if ( item ) | 419 | if ( item ) |
425 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 420 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
426 | KOPrefs::instance()->mWTshowDetails, | 421 | KOPrefs::instance()->mWTshowDetails, |
427 | KOPrefs::instance()->mWTshowCreated, | 422 | KOPrefs::instance()->mWTshowCreated, |
428 | KOPrefs::instance()->mWTshowChanged); | 423 | KOPrefs::instance()->mWTshowChanged); |
429 | return i18n("That is the list view" ); | 424 | return i18n("That is the list view" ); |
430 | 425 | ||
431 | } | 426 | } |
432 | 427 | ||
433 | void KOListView::setCalendar( int c ) | 428 | void KOListView::setCalendar( int c ) |
434 | { | 429 | { |
435 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 430 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
436 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 431 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
437 | i18n("Continue"), i18n("Cancel"), 0, | 432 | i18n("Continue"), i18n("Cancel"), 0, |
438 | 0, 1 ); | 433 | 0, 1 ); |
439 | if ( result != 0 ) { | 434 | if ( result != 0 ) { |
440 | return; | 435 | return; |
441 | } | 436 | } |
442 | 437 | ||
443 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 438 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
444 | int icount = delSel.count(); | 439 | int icount = delSel.count(); |
445 | if ( icount ) { | 440 | if ( icount ) { |
446 | Incidence *incidence = delSel.first(); | 441 | Incidence *incidence = delSel.first(); |
447 | while ( incidence ) { | 442 | while ( incidence ) { |
448 | incidence->setCalID( c ); | 443 | incidence->setCalID( c ); |
449 | KOListViewItem * item = getItemForEvent( incidence ); | 444 | KOListViewItem * item = getItemForEvent( incidence ); |
450 | if ( item ) { | 445 | if ( item ) { |
451 | ListItemVisitor v(item, mStartDate ); | 446 | ListItemVisitor v(item, mStartDate ); |
452 | incidence->accept(v); | 447 | incidence->accept(v); |
453 | } | 448 | } |
454 | incidence = delSel.next(); | 449 | incidence = delSel.next(); |
455 | } | 450 | } |
456 | } | 451 | } |
457 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 452 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
458 | KopiCalendarFile * cal = calendars.first(); | 453 | KopiCalendarFile * cal = calendars.first(); |
459 | while ( cal ) { | 454 | while ( cal ) { |
460 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 455 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
461 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 456 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
462 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 457 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
463 | if ( cal->isStandard ) | 458 | if ( cal->isStandard ) |
464 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 459 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
465 | cal = calendars.next(); | 460 | cal = calendars.next(); |
466 | } | 461 | } |
467 | mCalendar->setSyncEventsReadOnly(); | 462 | mCalendar->setSyncEventsReadOnly(); |
468 | mCalendar->reInitAlarmSettings(); | 463 | mCalendar->reInitAlarmSettings(); |
469 | 464 | ||
470 | } | 465 | } |
471 | void KOListView::populateCalPopup() | 466 | void KOListView::populateCalPopup() |
472 | { | 467 | { |
473 | mCalPopup->clear(); | 468 | mCalPopup->clear(); |
474 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 469 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
475 | while ( kkf ) { | 470 | while ( kkf ) { |
476 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 471 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
477 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 472 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
478 | mCalPopup->setItemEnabled( index, false ); | 473 | mCalPopup->setItemEnabled( index, false ); |
479 | kkf = KOPrefs::instance()->mCalendars.next(); | 474 | kkf = KOPrefs::instance()->mCalendars.next(); |
480 | } | 475 | } |
481 | } | 476 | } |
482 | void KOListView::updateList() | 477 | void KOListView::updateList() |
483 | { | 478 | { |
484 | // qDebug(" KOListView::updateList() "); | 479 | // qDebug(" KOListView::updateList() "); |
485 | 480 | ||
486 | } | 481 | } |
487 | 482 | ||
488 | void KOListView::clearList() | 483 | void KOListView::clearList() |
489 | { | 484 | { |
490 | clear (); | 485 | clear (); |
491 | } | 486 | } |
492 | 487 | ||
493 | void KOListView::setCat() | 488 | void KOListView::setCat() |
494 | { | 489 | { |
495 | 490 | ||
496 | bool set = true; | 491 | bool set = true; |
497 | int result = KMessageBox::warningYesNoCancel(this, | 492 | int result = KMessageBox::warningYesNoCancel(this, |
498 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 493 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
499 | i18n("Set categories"), | 494 | i18n("Set categories"), |
500 | i18n("Add"), | 495 | i18n("Add"), |
501 | i18n("Reset")); | 496 | i18n("Reset")); |
502 | if (result == KMessageBox::Cancel) return; | 497 | if (result == KMessageBox::Cancel) return; |
503 | if (result == KMessageBox::Yes) set = false; | 498 | if (result == KMessageBox::Yes) set = false; |
504 | setCategories( set ); | 499 | setCategories( set ); |
505 | } | 500 | } |
506 | 501 | ||
507 | void KOListView::setAlarm() | 502 | void KOListView::setAlarm() |
508 | { | 503 | { |
509 | KOAlarmPrefs kap( this); | 504 | KOAlarmPrefs kap( this); |
510 | if ( !kap.exec() ) | 505 | if ( !kap.exec() ) |
511 | return; | 506 | return; |
512 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 507 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
513 | Incidence* inc = delSel.first(); | 508 | Incidence* inc = delSel.first(); |
514 | int count = 0; | 509 | int count = 0; |
515 | while ( inc ) { | 510 | while ( inc ) { |
516 | ++count; | 511 | ++count; |
517 | if (kap.mAlarmButton->isChecked()) { | 512 | if (kap.mAlarmButton->isChecked()) { |
518 | if (inc->alarms().count() == 0) | 513 | if (inc->alarms().count() == 0) |
519 | inc->newAlarm(); | 514 | inc->newAlarm(); |
520 | Alarm *alarm = inc->alarms().first(); | 515 | Alarm *alarm = inc->alarms().first(); |
521 | alarm->setEnabled(true); | 516 | alarm->setEnabled(true); |
522 | int j = kap.mAlarmTimeEdit->value()* -60; | 517 | int j = kap.mAlarmTimeEdit->value()* -60; |
523 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 518 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
524 | j = j * 60; | 519 | j = j * 60; |
525 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 520 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
526 | j = j * (60 * 24); | 521 | j = j * (60 * 24); |
527 | alarm->setStartOffset( j ); | 522 | alarm->setStartOffset( j ); |
528 | 523 | ||
529 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 524 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
530 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 525 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
531 | } | 526 | } |
532 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 527 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
533 | alarm->setAudioAlarm(kap.mAlarmSound); | 528 | alarm->setAudioAlarm(kap.mAlarmSound); |
534 | else | 529 | else |
535 | alarm->setType(Alarm::Invalid); | 530 | alarm->setType(Alarm::Invalid); |
536 | } else { | 531 | } else { |
537 | QPtrList<Alarm> alarms = inc->alarms(); | 532 | QPtrList<Alarm> alarms = inc->alarms(); |
538 | Alarm *alarm; | 533 | Alarm *alarm; |
539 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 534 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
540 | alarm->setEnabled(false); | 535 | alarm->setEnabled(false); |
541 | alarm->setType(Alarm::Invalid); | 536 | alarm->setType(Alarm::Invalid); |
542 | } | 537 | } |
543 | } | 538 | } |
544 | KOListViewItem* item = getItemForEvent(inc); | 539 | KOListViewItem* item = getItemForEvent(inc); |
545 | if (item) { | 540 | if (item) { |
546 | ListItemVisitor v(item, mStartDate ); | 541 | ListItemVisitor v(item, mStartDate ); |
547 | inc->accept(v); | 542 | inc->accept(v); |
548 | } | 543 | } |
549 | inc = delSel.next(); | 544 | inc = delSel.next(); |
550 | } | 545 | } |
551 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 546 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
552 | qDebug("KO: Set alarm for %d items", count); | 547 | qDebug("KO: Set alarm for %d items", count); |
553 | calendar()->reInitAlarmSettings(); | 548 | calendar()->reInitAlarmSettings(); |
554 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 549 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
555 | } | 550 | } |
556 | void KOListView::setCategories( bool removeOld ) | 551 | void KOListView::setCategories( bool removeOld ) |
557 | { | 552 | { |
558 | 553 | ||
559 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 554 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
560 | csd->setColorEnabled(); | 555 | csd->setColorEnabled(); |
561 | if (! csd->exec()) { | 556 | if (! csd->exec()) { |
562 | delete csd; | 557 | delete csd; |
563 | return; | 558 | return; |
564 | } | 559 | } |
565 | QStringList catList = csd->selectedCategories(); | 560 | QStringList catList = csd->selectedCategories(); |
566 | delete csd; | 561 | delete csd; |
567 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 562 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
568 | Incidence* inc = delSel.first(); | 563 | Incidence* inc = delSel.first(); |
569 | while ( inc ) { | 564 | while ( inc ) { |
570 | if ( removeOld ) { | 565 | if ( removeOld ) { |
571 | inc->setCategories( catList, false ); | 566 | inc->setCategories( catList, false ); |
572 | } else { | 567 | } else { |
573 | inc->addCategories( catList, false ); | 568 | inc->addCategories( catList, false ); |
574 | } | 569 | } |
575 | KOListViewItem* item = getItemForEvent(inc); | 570 | KOListViewItem* item = getItemForEvent(inc); |
576 | if (item) { | 571 | if (item) { |
577 | ListItemVisitor v(item, mStartDate ); | 572 | ListItemVisitor v(item, mStartDate ); |
578 | inc->accept(v); | 573 | inc->accept(v); |
579 | } | 574 | } |
580 | inc = delSel.next(); | 575 | inc = delSel.next(); |
581 | } | 576 | } |
582 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 577 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
583 | } | 578 | } |
584 | 579 | ||
585 | void KOListView::beamSelected() | 580 | void KOListView::beamSelected() |
586 | { | 581 | { |
587 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 582 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
588 | if ( delSel.count() ) | 583 | if ( delSel.count() ) |
589 | emit beamIncidenceList( delSel ); | 584 | emit beamIncidenceList( delSel ); |
590 | } | 585 | } |
591 | 586 | ||
592 | void KOListView::saveDescriptionToFile() | 587 | void KOListView::saveDescriptionToFile() |
593 | { | 588 | { |
594 | 589 | ||
595 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 590 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
596 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 591 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
597 | i18n("Continue"), i18n("Cancel"), 0, | 592 | i18n("Continue"), i18n("Cancel"), 0, |
598 | 0, 1 ); | 593 | 0, 1 ); |
599 | if ( result != 0 ) { | 594 | if ( result != 0 ) { |
600 | return; | 595 | return; |
601 | } | 596 | } |
602 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 597 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
603 | int icount = delSel.count(); | 598 | int icount = delSel.count(); |
604 | if ( icount ) { | 599 | if ( icount ) { |
605 | QString fn = KOPrefs::instance()->mLastSaveFile; | 600 | QString fn = KOPrefs::instance()->mLastSaveFile; |
606 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 601 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
607 | 602 | ||
608 | if ( fn == "" ) | 603 | if ( fn == "" ) |
609 | return; | 604 | return; |
610 | QFileInfo info; | 605 | QFileInfo info; |
611 | info.setFile( fn ); | 606 | info.setFile( fn ); |
612 | QString mes; | 607 | QString mes; |
613 | bool createbup = true; | 608 | bool createbup = true; |
614 | if ( info. exists() ) { | 609 | if ( info. exists() ) { |
615 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 610 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
616 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 611 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
617 | i18n("Overwrite!"), i18n("Cancel"), 0, | 612 | i18n("Overwrite!"), i18n("Cancel"), 0, |
618 | 0, 1 ); | 613 | 0, 1 ); |
619 | if ( result != 0 ) { | 614 | if ( result != 0 ) { |
620 | createbup = false; | 615 | createbup = false; |
621 | } | 616 | } |
622 | } | 617 | } |
623 | if ( createbup ) { | 618 | if ( createbup ) { |
624 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 619 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
625 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 620 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
626 | Incidence *incidence = delSel.first(); | 621 | Incidence *incidence = delSel.first(); |
627 | icount = 0; | 622 | icount = 0; |
628 | while ( incidence ) { | 623 | while ( incidence ) { |
629 | if ( incidence->typeID() == journalID ) { | 624 | if ( incidence->typeID() == journalID ) { |
630 | text += "\n************************************\n"; | 625 | text += "\n************************************\n"; |
631 | if ( !incidence->summary().isEmpty() ) | 626 | if ( !incidence->summary().isEmpty() ) |
632 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); | 627 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); |
633 | else | 628 | else |
634 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 629 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
635 | if ( !incidence->location().isEmpty() ) | 630 | if ( !incidence->location().isEmpty() ) |
636 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 631 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
637 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 632 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
638 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 633 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
639 | ++icount; | 634 | ++icount; |
640 | 635 | ||
641 | } else { | 636 | } else { |
642 | if ( !incidence->description().isEmpty() ) { | 637 | if ( !incidence->description().isEmpty() ) { |
643 | text += "\n************************************\n"; | 638 | text += "\n************************************\n"; |
644 | if ( incidence->typeID() == todoID ) | 639 | if ( incidence->typeID() == todoID ) |
645 | text += i18n("To-Do: "); | 640 | text += i18n("To-Do: "); |
646 | text += incidence->summary(); | 641 | text += incidence->summary(); |
647 | if ( !incidence->location().isEmpty() ) | 642 | if ( !incidence->location().isEmpty() ) |
648 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 643 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
649 | if ( incidence->hasStartDate() ) | 644 | if ( incidence->hasStartDate() ) |
650 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 645 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
651 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 646 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
652 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 647 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
653 | ++icount; | 648 | ++icount; |
654 | 649 | ||
655 | } | 650 | } |
656 | } | 651 | } |
657 | incidence = delSel.next(); | 652 | incidence = delSel.next(); |
658 | } | 653 | } |
659 | QFile file( fn ); | 654 | QFile file( fn ); |
660 | if (!file.open( IO_WriteOnly ) ) { | 655 | if (!file.open( IO_WriteOnly ) ) { |
661 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 656 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
662 | return; | 657 | return; |
663 | } | 658 | } |
664 | QTextStream ts( &file ); | 659 | QTextStream ts( &file ); |
665 | ts << text; | 660 | ts << text; |
666 | file.close(); | 661 | file.close(); |
667 | //qDebug("%s ", text.latin1()); | 662 | //qDebug("%s ", text.latin1()); |
668 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 663 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
669 | KOPrefs::instance()->mLastSaveFile = fn; | 664 | KOPrefs::instance()->mLastSaveFile = fn; |
670 | topLevelWidget()->setCaption(mes); | 665 | topLevelWidget()->setCaption(mes); |
671 | } | 666 | } |
672 | } | 667 | } |
673 | } | 668 | } |
674 | void KOListView::saveToFileVCS() | 669 | void KOListView::saveToFileVCS() |
675 | { | 670 | { |
676 | writeToFile( false ); | 671 | writeToFile( false ); |
677 | } | 672 | } |
678 | void KOListView::saveToFile() | 673 | void KOListView::saveToFile() |
679 | { | 674 | { |
680 | writeToFile( true ); | 675 | writeToFile( true ); |
681 | } | 676 | } |
682 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 677 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
683 | { | 678 | { |
684 | QPtrList<Incidence> delSel ; | 679 | QPtrList<Incidence> delSel ; |
685 | bool addSubTodos = false; | 680 | bool addSubTodos = false; |
686 | bool askSubTodos = true; | 681 | bool askSubTodos = true; |
687 | QListViewItem *item = mListView->firstChild (); | 682 | QListViewItem *item = mListView->firstChild (); |
688 | while ( item ) { | 683 | while ( item ) { |
689 | if ( item->isSelected() ) { | 684 | if ( item->isSelected() ) { |
690 | Incidence* inc = ((KOListViewItem *)item)->data(); | 685 | Incidence* inc = ((KOListViewItem *)item)->data(); |
691 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 686 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
692 | if ( (inc->typeID() == todoID && includeTodos) || | 687 | if ( (inc->typeID() == todoID && includeTodos) || |
693 | (inc->typeID() == eventID && includeEvents) || | 688 | (inc->typeID() == eventID && includeEvents) || |
694 | (inc->typeID() == journalID && includeJournals) ) { | 689 | (inc->typeID() == journalID && includeJournals) ) { |
695 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 690 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
696 | if ( ((Todo*)inc)->hasDueDate() ) | 691 | if ( ((Todo*)inc)->hasDueDate() ) |
697 | delSel.append( inc ); | 692 | delSel.append( inc ); |
698 | } else | 693 | } else |
699 | delSel.append( inc ); | 694 | delSel.append( inc ); |
700 | 695 | ||
701 | } | 696 | } |
702 | } | 697 | } |
703 | if ( inc->typeID() == todoID ) { | 698 | if ( inc->typeID() == todoID ) { |
704 | Todo * todo = (Todo*) inc; | 699 | Todo * todo = (Todo*) inc; |
705 | if ( todo->relations().count() ) { | 700 | if ( todo->relations().count() ) { |
706 | if ( askSubTodos ) { | 701 | if ( askSubTodos ) { |
707 | int result = KMessageBox::warningYesNoCancel(this, | 702 | int result = KMessageBox::warningYesNoCancel(this, |
708 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), | 703 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
709 | i18n("Todo has subtodos"), | 704 | i18n("Todo has subtodos"), |
710 | i18n("Yes"), | 705 | i18n("Yes"), |
711 | i18n("No")); | 706 | i18n("No")); |
712 | if ( result == KMessageBox::Cancel ) { | 707 | if ( result == KMessageBox::Cancel ) { |
713 | delSel.clear(); | 708 | delSel.clear(); |
714 | return delSel; | 709 | return delSel; |
715 | } | 710 | } |
716 | if (result == KMessageBox::Yes) | 711 | if (result == KMessageBox::Yes) |
717 | addSubTodos = true; | 712 | addSubTodos = true; |
718 | askSubTodos = false; | 713 | askSubTodos = false; |
719 | } | 714 | } |
720 | if ( addSubTodos ) { | 715 | if ( addSubTodos ) { |
721 | QPtrList<Incidence> tempSel ; | 716 | QPtrList<Incidence> tempSel ; |
722 | inc->addRelationsToList( &tempSel ); | 717 | inc->addRelationsToList( &tempSel ); |
723 | Incidence* tempinc = tempSel.first(); | 718 | Incidence* tempinc = tempSel.first(); |
724 | while ( tempinc ) { | 719 | while ( tempinc ) { |
725 | if ( delSel.findRef( tempinc ) == -1 ) { | 720 | if ( delSel.findRef( tempinc ) == -1 ) { |
726 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | 721 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { |
727 | if ( ((Todo*)tempinc)->hasDueDate() ) | 722 | if ( ((Todo*)tempinc)->hasDueDate() ) |
728 | delSel.append( tempinc ); | 723 | delSel.append( tempinc ); |
729 | } else | 724 | } else |
730 | delSel.append( tempinc ); | 725 | delSel.append( tempinc ); |
731 | } | 726 | } |
732 | tempinc = tempSel.next(); | 727 | tempinc = tempSel.next(); |
733 | } | 728 | } |
734 | } | 729 | } |
735 | } | 730 | } |
736 | } | 731 | } |
737 | } | 732 | } |
738 | item = item->nextSibling(); | 733 | item = item->nextSibling(); |
739 | } | 734 | } |
740 | return delSel; | 735 | return delSel; |
741 | } | 736 | } |
742 | 737 | ||
743 | void KOListView::writeToFile( bool iCal ) | 738 | void KOListView::writeToFile( bool iCal ) |
744 | { | 739 | { |
745 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 740 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
746 | if ( !iCal ) { | 741 | if ( !iCal ) { |
747 | bool journal = false; | 742 | bool journal = false; |
748 | Incidence *incidence = delSel.first(); | 743 | Incidence *incidence = delSel.first(); |
749 | while ( incidence ) { | 744 | while ( incidence ) { |
750 | if ( incidence->typeID() == journalID ) { | 745 | if ( incidence->typeID() == journalID ) { |
751 | journal = true; | 746 | journal = true; |
752 | break; | 747 | break; |
753 | } | 748 | } |
754 | incidence = delSel.next(); | 749 | incidence = delSel.next(); |
755 | } | 750 | } |
756 | if ( journal ) { | 751 | if ( journal ) { |
757 | int result = KMessageBox::warningContinueCancel(this, | 752 | int result = KMessageBox::warningContinueCancel(this, |
758 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 753 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
759 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 754 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
760 | true); | 755 | true); |
761 | if (result != KMessageBox::Continue) return; | 756 | if (result != KMessageBox::Continue) return; |
762 | } | 757 | } |
763 | } | 758 | } |
764 | if ( delSel.count() ) { | 759 | if ( delSel.count() ) { |
765 | QString fn = KOPrefs::instance()->mLastSaveFile; | 760 | QString fn = KOPrefs::instance()->mLastSaveFile; |
766 | QString extension; | 761 | QString extension; |
767 | if ( iCal ) { | 762 | if ( iCal ) { |
768 | if ( fn.right( 4 ).lower() == ".vcs" ) { | 763 | if ( fn.right( 4 ).lower() == ".vcs" ) { |
769 | fn = fn.left( fn.length() -3) + "ics"; | 764 | fn = fn.left( fn.length() -3) + "ics"; |
770 | } | 765 | } |
771 | } else { | 766 | } else { |
772 | if ( fn.right( 4 ).lower() == ".ics" ) { | 767 | if ( fn.right( 4 ).lower() == ".ics" ) { |
773 | fn = fn.left( fn.length() -3) + "vcs"; | 768 | fn = fn.left( fn.length() -3) + "vcs"; |
774 | } | 769 | } |
775 | } | 770 | } |
776 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 771 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
777 | 772 | ||
778 | if ( fn == "" ) | 773 | if ( fn == "" ) |
779 | return; | 774 | return; |
780 | QFileInfo info; | 775 | QFileInfo info; |
781 | info.setFile( fn ); | 776 | info.setFile( fn ); |
782 | QString mes; | 777 | QString mes; |
783 | bool createbup = true; | 778 | bool createbup = true; |
784 | if ( info. exists() ) { | 779 | if ( info. exists() ) { |
785 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 780 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
786 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 781 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
787 | i18n("Overwrite!"), i18n("Cancel"), 0, | 782 | i18n("Overwrite!"), i18n("Cancel"), 0, |
788 | 0, 1 ); | 783 | 0, 1 ); |
789 | if ( result != 0 ) { | 784 | if ( result != 0 ) { |
790 | createbup = false; | 785 | createbup = false; |
791 | } | 786 | } |
792 | } | 787 | } |
793 | if ( createbup ) { | 788 | if ( createbup ) { |
794 | CalendarLocal cal; | 789 | CalendarLocal cal; |
795 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 790 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
796 | Incidence *incidence = delSel.first(); | 791 | Incidence *incidence = delSel.first(); |
797 | while ( incidence ) { | 792 | while ( incidence ) { |
798 | cal.addIncidence( incidence->clone() ); | 793 | cal.addIncidence( incidence->clone() ); |
799 | incidence = delSel.next(); | 794 | incidence = delSel.next(); |
800 | } | 795 | } |
801 | if ( iCal ) { | 796 | if ( iCal ) { |
802 | ICalFormat format; | 797 | ICalFormat format; |
803 | format.save( &cal, fn ); | 798 | format.save( &cal, fn ); |
804 | } else { | 799 | } else { |
805 | 800 | ||
806 | VCalFormat format; | 801 | VCalFormat format; |
807 | format.save( &cal, fn ); | 802 | format.save( &cal, fn ); |
808 | } | 803 | } |
809 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 804 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
810 | KOPrefs::instance()->mLastSaveFile = fn; | 805 | KOPrefs::instance()->mLastSaveFile = fn; |
811 | topLevelWidget()->setCaption(mes); | 806 | topLevelWidget()->setCaption(mes); |
812 | } | 807 | } |
813 | } | 808 | } |
814 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 809 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
815 | } | 810 | } |
816 | void KOListView::hideAll() | 811 | void KOListView::hideAll() |
817 | { | 812 | { |
818 | QPtrList<QListViewItem> delSel ; | 813 | QPtrList<QListViewItem> delSel ; |
819 | QListViewItem *item = mListView->firstChild (); | 814 | QListViewItem *item = mListView->firstChild (); |
820 | while ( item ) { | 815 | while ( item ) { |
821 | if ( item->isSelected() ) { | 816 | if ( item->isSelected() ) { |
822 | delSel.append(item); | 817 | delSel.append(item); |
823 | } | 818 | } |
824 | item = item->nextSibling(); | 819 | item = item->nextSibling(); |
825 | } | 820 | } |
826 | item = delSel.first() ; | 821 | item = delSel.first() ; |
827 | while ( item ) { | 822 | while ( item ) { |
828 | QListViewItem * del = item; | 823 | QListViewItem * del = item; |
829 | item = delSel.next(); | 824 | item = delSel.next(); |
830 | delete del; | 825 | delete del; |
831 | } | 826 | } |
832 | } | 827 | } |
833 | void KOListView::printList() | 828 | void KOListView::printList() |
834 | { | 829 | { |
835 | mListView->printList(); | 830 | mListView->printList(); |
836 | } | 831 | } |
837 | void KOListView::deleteAll() | 832 | void KOListView::deleteAll() |
838 | { | 833 | { |
839 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; | 834 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; |
840 | if ( delSel.count() ) { | 835 | if ( delSel.count() ) { |
841 | int icount = delSel.count(); | 836 | int icount = delSel.count(); |
842 | Incidence *incidence = delSel.first(); | 837 | Incidence *incidence = delSel.first(); |
843 | Incidence *toDelete; | 838 | Incidence *toDelete; |
844 | KOPrefs *p = KOPrefs::instance(); | 839 | KOPrefs *p = KOPrefs::instance(); |
845 | bool confirm = p->mConfirm; | 840 | bool confirm = p->mConfirm; |
846 | QString mess; | 841 | QString mess; |
847 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 842 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
848 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 843 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
849 | p->mConfirm = false; | 844 | p->mConfirm = false; |
850 | int delCounter = 0; | 845 | int delCounter = 0; |
851 | QDialog dia ( this, "p-dialog", true ); | 846 | QDialog dia ( this, "p-dialog", true ); |
852 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 847 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
853 | QVBoxLayout lay( &dia ); | 848 | QVBoxLayout lay( &dia ); |
854 | lay.setMargin(7); | 849 | lay.setMargin(7); |
855 | lay.setSpacing(7); | 850 | lay.setSpacing(7); |
856 | lay.addWidget( &lab); | 851 | lay.addWidget( &lab); |
857 | QProgressBar bar( icount, &dia ); | 852 | QProgressBar bar( icount, &dia ); |
858 | lay.addWidget( &bar); | 853 | lay.addWidget( &bar); |
859 | int w = 220; | 854 | int w = 220; |
860 | int h = 50; | 855 | int h = 50; |
861 | int dw = QApplication::desktop()->width(); | 856 | int dw = QApplication::desktop()->width(); |
862 | int dh = QApplication::desktop()->height(); | 857 | int dh = QApplication::desktop()->height(); |
863 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 858 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
864 | //dia.resize( 240,50 ); | 859 | //dia.resize( 240,50 ); |
865 | dia.show(); | 860 | dia.show(); |
866 | KOPrefs::instance()->mGlobalUpdateDisabled = true; | 861 | KOPrefs::instance()->mGlobalUpdateDisabled = true; |
867 | while ( incidence ) { | 862 | while ( incidence ) { |
868 | bar.setProgress( delCounter ); | 863 | bar.setProgress( delCounter ); |
869 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 864 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
870 | dia.setCaption( mess ); | 865 | dia.setCaption( mess ); |
871 | qApp->processEvents(); | 866 | qApp->processEvents(); |
872 | toDelete = (incidence); | 867 | toDelete = (incidence); |
873 | incidence = delSel.next(); | 868 | incidence = delSel.next(); |
874 | emit deleteIncidenceSignal(toDelete ); | 869 | emit deleteIncidenceSignal(toDelete ); |
875 | if ( dia.result() != 0 ) | 870 | if ( dia.result() != 0 ) |
876 | break; | 871 | break; |
877 | 872 | ||
878 | } | 873 | } |
879 | KOPrefs::instance()->mGlobalUpdateDisabled = false; | 874 | KOPrefs::instance()->mGlobalUpdateDisabled = false; |
880 | emit deleteIncidenceSignal( 0 ); | 875 | emit deleteIncidenceSignal( 0 ); |
881 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 876 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
882 | topLevelWidget ()->setCaption( mess ); | 877 | topLevelWidget ()->setCaption( mess ); |
883 | p->mConfirm = confirm; | 878 | p->mConfirm = confirm; |
884 | } | 879 | } |
885 | } | 880 | } |
886 | 881 | ||
887 | 882 | ||
888 | } | 883 | } |
889 | int KOListView::maxDatesHint() | 884 | int KOListView::maxDatesHint() |
890 | { | 885 | { |
891 | return 0; | 886 | return 0; |
892 | } | 887 | } |
893 | 888 | ||
894 | int KOListView::currentDateCount() | 889 | int KOListView::currentDateCount() |
895 | { | 890 | { |
896 | return 0; | 891 | return 0; |
897 | } | 892 | } |
898 | 893 | ||
899 | QPtrList<Incidence> KOListView::selectedIncidences() | 894 | QPtrList<Incidence> KOListView::selectedIncidences() |
900 | { | 895 | { |
901 | QPtrList<Incidence> eventList; | 896 | QPtrList<Incidence> eventList; |
902 | QListViewItem *item = mListView->firstChild (); | 897 | QListViewItem *item = mListView->firstChild (); |
903 | while ( item ) { | 898 | while ( item ) { |
904 | if ( item->isSelected() ) { | 899 | if ( item->isSelected() ) { |
905 | eventList.append(((KOListViewItem *)item)->data()); | 900 | eventList.append(((KOListViewItem *)item)->data()); |
906 | } | 901 | } |
907 | 902 | ||
908 | item = item->nextSibling(); | 903 | item = item->nextSibling(); |
909 | } | 904 | } |
910 | 905 | ||
911 | // // QListViewItem *item = mListView->selectedItem(); | 906 | // // QListViewItem *item = mListView->selectedItem(); |
912 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 907 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
913 | 908 | ||
914 | return eventList; | 909 | return eventList; |
915 | } | 910 | } |
916 | 911 | ||
917 | DateList KOListView::selectedDates() | 912 | DateList KOListView::selectedDates() |
918 | { | 913 | { |
919 | DateList eventList; | 914 | DateList eventList; |
920 | return eventList; | 915 | return eventList; |
921 | } | 916 | } |
922 | 917 | ||
923 | void KOListView::showDates(bool show) | 918 | void KOListView::showDates(bool show) |
924 | { | 919 | { |
925 | // Shouldn't we set it to a value greater 0? When showDates is called with | 920 | // Shouldn't we set it to a value greater 0? When showDates is called with |
926 | // show == true at first, then the columnwidths are set to zero. | 921 | // show == true at first, then the columnwidths are set to zero. |
927 | static int oldColWidth1 = 0; | 922 | static int oldColWidth1 = 0; |
928 | static int oldColWidth3 = 0; | 923 | static int oldColWidth3 = 0; |
929 | 924 | ||
930 | if (!show) { | 925 | if (!show) { |
931 | oldColWidth1 = mListView->columnWidth(1); | 926 | oldColWidth1 = mListView->columnWidth(1); |
932 | oldColWidth3 = mListView->columnWidth(3); | 927 | oldColWidth3 = mListView->columnWidth(3); |
933 | mListView->setColumnWidth(1, 0); | 928 | mListView->setColumnWidth(1, 0); |
934 | mListView->setColumnWidth(3, 0); | 929 | mListView->setColumnWidth(3, 0); |
935 | } else { | 930 | } else { |
936 | mListView->setColumnWidth(1, oldColWidth1); | 931 | mListView->setColumnWidth(1, oldColWidth1); |
937 | mListView->setColumnWidth(3, oldColWidth3); | 932 | mListView->setColumnWidth(3, oldColWidth3); |
938 | } | 933 | } |
939 | mListView->repaint(); | 934 | mListView->repaint(); |
940 | } | 935 | } |
941 | 936 | ||
942 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 937 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
943 | const QDate &td) | 938 | const QDate &td) |
944 | { | 939 | { |
945 | #ifndef KORG_NOPRINTER | 940 | #ifndef KORG_NOPRINTER |
946 | calPrinter->preview(CalPrinter::Day, fd, td); | 941 | calPrinter->preview(CalPrinter::Day, fd, td); |
947 | #endif | 942 | #endif |
948 | } | 943 | } |
949 | 944 | ||
950 | void KOListView::showDates() | 945 | void KOListView::showDates() |
951 | { | 946 | { |
952 | showDates(true); | 947 | showDates(true); |
953 | } | 948 | } |
954 | 949 | ||
955 | void KOListView::hideDates() | 950 | void KOListView::hideDates() |
956 | { | 951 | { |
957 | showDates(false); | 952 | showDates(false); |
958 | } | 953 | } |
959 | 954 | ||
960 | void KOListView::resetFocus() | 955 | void KOListView::resetFocus() |
961 | { | 956 | { |
962 | topLevelWidget()->setActiveWindow(); | 957 | topLevelWidget()->setActiveWindow(); |
963 | topLevelWidget()->raise(); | 958 | topLevelWidget()->raise(); |
964 | mListView->setFocus(); | 959 | mListView->setFocus(); |
965 | } | 960 | } |
966 | void KOListView::updateView() | 961 | void KOListView::updateView() |
967 | { | 962 | { |
968 | mListView->setFocus(); | 963 | mListView->setFocus(); |
969 | if ( mListView->firstChild () ) { | 964 | if ( mListView->firstChild () ) { |
970 | mListView->setCurrentItem( mListView->firstChild () ); | 965 | mListView->setCurrentItem( mListView->firstChild () ); |
971 | } | 966 | } |
972 | processSelectionChange( mListView->firstChild () ); | 967 | processSelectionChange( mListView->firstChild () ); |
973 | } | 968 | } |
974 | void KOListView::updateConfig() | 969 | void KOListView::updateConfig() |
975 | { | 970 | { |
976 | 971 | ||
977 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 972 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
978 | updateView(); | 973 | updateView(); |
979 | 974 | ||
980 | } | 975 | } |
981 | void KOListView::setStartDate(const QDate &start) | 976 | void KOListView::setStartDate(const QDate &start) |
982 | { | 977 | { |
983 | mStartDate = start; | 978 | mStartDate = start; |
984 | } | 979 | } |
985 | 980 | ||
986 | void KOListView::showDates(const QDate &start, const QDate &end) | 981 | void KOListView::showDates(const QDate &start, const QDate &end) |
987 | { | 982 | { |
988 | clear(); | 983 | clear(); |
989 | mStartDate = start; | 984 | mStartDate = start; |
990 | QDate date = start; | 985 | QDate date = start; |
991 | while( date <= end ) { | 986 | while( date <= end ) { |
992 | addEvents(calendar()->events(date)); | 987 | addEvents(calendar()->events(date)); |
993 | addTodos(calendar()->todos(date)); | 988 | addTodos(calendar()->todos(date)); |
994 | addJournals( calendar()->journals4Date(date) ); | 989 | addJournals( calendar()->journals4Date(date) ); |
995 | date = date.addDays( 1 ); | 990 | date = date.addDays( 1 ); |
996 | } | 991 | } |
997 | //emit incidenceSelected( 0 ); | 992 | //emit incidenceSelected( 0 ); |
998 | updateView(); | 993 | updateView(); |
999 | 994 | ||
1000 | } | 995 | } |
1001 | 996 | ||
1002 | void KOListView::addEvents(QPtrList<Event> eventList) | 997 | void KOListView::addEvents(QPtrList<Event> eventList) |
1003 | { | 998 | { |
1004 | 999 | ||
1005 | Event *ev; | 1000 | Event *ev; |
1006 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1001 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1007 | addIncidence(ev); | 1002 | addIncidence(ev); |
1008 | } | 1003 | } |
1009 | if ( !mListView->currentItem() ){ | 1004 | if ( !mListView->currentItem() ){ |
1010 | updateView(); | 1005 | updateView(); |
1011 | } | 1006 | } |
1012 | } | 1007 | } |
1013 | 1008 | ||
1014 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1009 | void KOListView::addTodos(QPtrList<Todo> eventList) |
1015 | { | 1010 | { |
1016 | Todo *ev; | 1011 | Todo *ev; |
1017 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1012 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1018 | addIncidence(ev); | 1013 | addIncidence(ev); |
1019 | } | 1014 | } |
1020 | if ( !mListView->currentItem() ){ | 1015 | if ( !mListView->currentItem() ){ |
1021 | updateView(); | 1016 | updateView(); |
1022 | } | 1017 | } |
1023 | } | 1018 | } |
1024 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1019 | void KOListView::addJournals(QPtrList<Journal> eventList) |
1025 | { | 1020 | { |
1026 | Journal *ev; | 1021 | Journal *ev; |
1027 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1022 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1028 | addIncidence(ev); | 1023 | addIncidence(ev); |
1029 | } | 1024 | } |
1030 | if ( !mListView->currentItem() ){ | 1025 | if ( !mListView->currentItem() ){ |
1031 | updateView(); | 1026 | updateView(); |
1032 | } | 1027 | } |
1033 | } | 1028 | } |
1034 | 1029 | ||
1035 | void KOListView::showCompletedTodos() | 1030 | void KOListView::showCompletedTodos() |
1036 | { | 1031 | { |
1037 | mForceShowCompletedTodos = true; | 1032 | mForceShowCompletedTodos = true; |
1038 | } | 1033 | } |
1039 | void KOListView::addIncidence(Incidence *incidence) | 1034 | void KOListView::addIncidence(Incidence *incidence) |
1040 | { | 1035 | { |
1041 | if ( mUidDict.find( incidence->uid() ) ) return; | 1036 | if ( mUidDict.find( incidence->uid() ) ) return; |
1042 | 1037 | ||
1043 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 1038 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
1044 | if ( incidence->typeID() == todoID ) { | 1039 | if ( incidence->typeID() == todoID ) { |
1045 | if ( ! mForceShowCompletedTodos ) { | 1040 | if ( ! mForceShowCompletedTodos ) { |
1046 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) | 1041 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) |
1047 | return; | 1042 | return; |
1048 | } | 1043 | } |
1049 | } | 1044 | } |
1050 | mUidDict.insert( incidence->uid(), incidence ); | 1045 | mUidDict.insert( incidence->uid(), incidence ); |
1051 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1046 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1052 | ListItemVisitor v(item, mStartDate ); | 1047 | ListItemVisitor v(item, mStartDate ); |
1053 | if (incidence->accept(v)) { | 1048 | if (incidence->accept(v)) { |
1054 | return; | 1049 | return; |
1055 | } | 1050 | } |
1056 | else delete item; | 1051 | else delete item; |
1057 | } | 1052 | } |
1058 | 1053 | ||
1059 | void KOListView::showEvents(QPtrList<Event> eventList) | 1054 | void KOListView::showEvents(QPtrList<Event> eventList) |
1060 | { | 1055 | { |
1061 | clear(); | 1056 | clear(); |
1062 | 1057 | ||
1063 | addEvents(eventList); | 1058 | addEvents(eventList); |
1064 | 1059 | ||
1065 | // After new creation of list view no events are selected. | 1060 | // After new creation of list view no events are selected. |
1066 | emit incidenceSelected( 0 ); | 1061 | emit incidenceSelected( 0 ); |
1067 | } | 1062 | } |
1068 | int KOListView::count() | 1063 | int KOListView::count() |
1069 | { | 1064 | { |
1070 | return mListView->childCount(); | 1065 | return mListView->childCount(); |
1071 | } | 1066 | } |
1072 | 1067 | ||
1073 | void KOListView::changeEventDisplay(Event *event, int action) | 1068 | void KOListView::changeEventDisplay(Event *event, int action) |
1074 | { | 1069 | { |
1075 | KOListViewItem *item; | 1070 | KOListViewItem *item; |
1076 | 1071 | ||
1077 | switch(action) { | 1072 | switch(action) { |
1078 | case KOGlobals::EVENTADDED: | 1073 | case KOGlobals::EVENTADDED: |
1079 | addIncidence( event ); | 1074 | addIncidence( event ); |
1080 | break; | 1075 | break; |
1081 | case KOGlobals::EVENTEDITED: | 1076 | case KOGlobals::EVENTEDITED: |
1082 | item = getItemForEvent(event); | 1077 | item = getItemForEvent(event); |
1083 | if (item) { | 1078 | if (item) { |
1084 | ListItemVisitor v(item, mStartDate ); | 1079 | ListItemVisitor v(item, mStartDate ); |
1085 | ((Incidence*)event)->accept(v); | 1080 | ((Incidence*)event)->accept(v); |
1086 | } | 1081 | } |
1087 | break; | 1082 | break; |
1088 | case KOGlobals::EVENTDELETED: | 1083 | case KOGlobals::EVENTDELETED: |
1089 | item = getItemForEvent(event); | 1084 | item = getItemForEvent(event); |
1090 | if (item) { | 1085 | if (item) { |
1091 | mUidDict.remove( event->uid() ); | 1086 | mUidDict.remove( event->uid() ); |
1092 | delete item; | 1087 | delete item; |
1093 | } | 1088 | } |
1094 | break; | 1089 | break; |
1095 | default: | 1090 | default: |
1096 | ; | 1091 | ; |
1097 | } | 1092 | } |
1098 | } | 1093 | } |
1099 | 1094 | ||
1100 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1095 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1101 | { | 1096 | { |
1102 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1097 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1103 | while (item) { | 1098 | while (item) { |
1104 | if (item->data() == event) return item; | 1099 | if (item->data() == event) return item; |
1105 | item = (KOListViewItem *)item->nextSibling(); | 1100 | item = (KOListViewItem *)item->nextSibling(); |
1106 | } | 1101 | } |
1107 | return 0; | 1102 | return 0; |
1108 | } | 1103 | } |
1109 | 1104 | ||
1110 | void KOListView::defaultItemAction(QListViewItem *i) | 1105 | void KOListView::defaultItemAction(QListViewItem *i) |
1111 | { | 1106 | { |
1112 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1107 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1113 | if ( item ) defaultAction( item->data() ); | 1108 | if ( item ) defaultAction( item->data() ); |
1114 | 1109 | ||
1115 | } | 1110 | } |
1116 | 1111 | ||
1117 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1112 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
1118 | { | 1113 | { |
1119 | mActiveItem = (KOListViewItem *)item; | 1114 | mActiveItem = (KOListViewItem *)item; |
1120 | if (mActiveItem) { | 1115 | if (mActiveItem) { |
1121 | Incidence *incidence = mActiveItem->data(); | 1116 | Incidence *incidence = mActiveItem->data(); |
1122 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1117 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1123 | mPopupMenu->showIncidencePopup(incidence); | 1118 | mPopupMenu->showIncidencePopup(incidence); |
1124 | 1119 | ||
1125 | /* | 1120 | /* |
1126 | if ( incidence && incidence->type() == "Event" ) { | 1121 | if ( incidence && incidence->type() == "Event" ) { |
1127 | Event *event = static_cast<Event *>( incidence ); | 1122 | Event *event = static_cast<Event *>( incidence ); |
1128 | mPopupMenu->showEventPopup(event); | 1123 | mPopupMenu->showEventPopup(event); |
1129 | } | 1124 | } |
1130 | */ | 1125 | */ |
1131 | } | 1126 | } |
1132 | } | 1127 | } |
1133 | 1128 | ||
1134 | void KOListView::readSettings(KConfig *config, QString setting) | 1129 | void KOListView::readSettings(KConfig *config, QString setting) |
1135 | { | 1130 | { |
1136 | // qDebug("KOListView::readSettings "); | 1131 | // qDebug("KOListView::readSettings "); |
1137 | mListView->restoreLayout(config,setting); | 1132 | mListView->restoreLayout(config,setting); |
1138 | } | 1133 | } |
1139 | 1134 | ||
1140 | void KOListView::writeSettings(KConfig *config, QString setting) | 1135 | void KOListView::writeSettings(KConfig *config, QString setting) |
1141 | { | 1136 | { |
1142 | // qDebug("KOListView::writeSettings "); | 1137 | // qDebug("KOListView::writeSettings "); |
1143 | mListView->saveLayout(config, setting); | 1138 | mListView->saveLayout(config, setting); |
1144 | } | 1139 | } |
1145 | 1140 | ||
1146 | void KOListView::processSelectionChange(QListViewItem *) | 1141 | void KOListView::processSelectionChange(QListViewItem *) |
1147 | { | 1142 | { |
1148 | 1143 | ||
1149 | KOListViewItem *item = | 1144 | KOListViewItem *item = |
1150 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 1145 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
1151 | 1146 | ||
1152 | if ( !item ) { | 1147 | if ( !item ) { |
1153 | emit incidenceSelected( 0 ); | 1148 | emit incidenceSelected( 0 ); |
1154 | } else { | 1149 | } else { |
1155 | emit incidenceSelected( item->data() ); | 1150 | emit incidenceSelected( item->data() ); |
1156 | } | 1151 | } |
1157 | } | 1152 | } |
1158 | 1153 | ||
1159 | void KOListView::clearSelection() | 1154 | void KOListView::clearSelection() |
1160 | { | 1155 | { |
1161 | mListView->selectAll( false ); | 1156 | mListView->selectAll( false ); |
1162 | } | 1157 | } |
1163 | void KOListView::allSelection() | 1158 | void KOListView::allSelection() |
1164 | { | 1159 | { |
1165 | mListView->selectAll( true ); | 1160 | mListView->selectAll( true ); |
1166 | } | 1161 | } |
1167 | 1162 | ||
1168 | void KOListView::clear() | 1163 | void KOListView::clear() |
1169 | { | 1164 | { |
1170 | mListView->clear(); | 1165 | mListView->clear(); |
1171 | mUidDict.clear(); | 1166 | mUidDict.clear(); |
1172 | } | 1167 | } |
1173 | 1168 | ||
1174 | Incidence* KOListView::currentItem() | 1169 | Incidence* KOListView::currentItem() |
1175 | { | 1170 | { |
1176 | if ( mListView->currentItem() ) | 1171 | if ( mListView->currentItem() ) |
1177 | return ((KOListViewItem*) mListView->currentItem())->data(); | 1172 | return ((KOListViewItem*) mListView->currentItem())->data(); |
1178 | return 0; | 1173 | return 0; |
1179 | } | 1174 | } |
1180 | void KOListView::keyPressEvent ( QKeyEvent *e) | 1175 | void KOListView::keyPressEvent ( QKeyEvent *e) |
1181 | { | 1176 | { |
1182 | 1177 | ||
1183 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 1178 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1184 | deleteAll(); | 1179 | deleteAll(); |
1185 | return; | 1180 | return; |
1186 | } | 1181 | } |
1187 | 1182 | ||
1188 | e->ignore(); | 1183 | e->ignore(); |
1189 | } | 1184 | } |
1190 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1185 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1191 | { | 1186 | { |
1192 | 1187 | ||
1193 | switch ( e->key() ) { | 1188 | switch ( e->key() ) { |
1194 | case Qt::Key_Down: | 1189 | case Qt::Key_Down: |
1195 | if ( e->state() == ShiftButton ) { | 1190 | if ( e->state() == ShiftButton ) { |
1196 | QListViewItem* cn = currentItem(); | 1191 | QListViewItem* cn = currentItem(); |
1197 | if ( !cn ) | 1192 | if ( !cn ) |
1198 | cn = firstChild(); | 1193 | cn = firstChild(); |
1199 | if ( !cn ) | 1194 | if ( !cn ) |
1200 | return; | 1195 | return; |
1201 | while ( cn->nextSibling() ) | 1196 | while ( cn->nextSibling() ) |
1202 | cn = cn->nextSibling(); | 1197 | cn = cn->nextSibling(); |
1203 | setCurrentItem ( cn ); | 1198 | setCurrentItem ( cn ); |
1204 | ensureItemVisible ( cn ); | 1199 | ensureItemVisible ( cn ); |
1205 | 1200 | ||
1206 | e->accept(); | 1201 | e->accept(); |
1207 | return; | 1202 | return; |
1208 | } | 1203 | } |
1209 | if ( e->state() == ControlButton ) { | 1204 | if ( e->state() == ControlButton ) { |
1210 | int count = childCount (); | 1205 | int count = childCount (); |
1211 | int jump = count / 5; | 1206 | int jump = count / 5; |
1212 | QListViewItem* cn; | 1207 | QListViewItem* cn; |
1213 | cn = currentItem(); | 1208 | cn = currentItem(); |
1214 | if ( ! cn ) | 1209 | if ( ! cn ) |
1215 | return; | 1210 | return; |
1216 | if ( jump == 0 ) | 1211 | if ( jump == 0 ) |
1217 | jump = 1; | 1212 | jump = 1; |
1218 | while ( jump && cn->nextSibling() ) { | 1213 | while ( jump && cn->nextSibling() ) { |
1219 | cn = cn->nextSibling(); | 1214 | cn = cn->nextSibling(); |
1220 | --jump; | 1215 | --jump; |
1221 | } | 1216 | } |
1222 | setCurrentItem ( cn ); | 1217 | setCurrentItem ( cn ); |
1223 | ensureItemVisible ( cn ); | 1218 | ensureItemVisible ( cn ); |
1224 | 1219 | ||
1225 | } else | 1220 | } else |
1226 | QListView::keyPressEvent ( e ) ; | 1221 | QListView::keyPressEvent ( e ) ; |
1227 | e->accept(); | 1222 | e->accept(); |
1228 | break; | 1223 | break; |
1229 | 1224 | ||
1230 | case Qt::Key_Up: | 1225 | case Qt::Key_Up: |
1231 | if ( e->state() == ShiftButton ) { | 1226 | if ( e->state() == ShiftButton ) { |
1232 | QListViewItem* cn = firstChild(); | 1227 | QListViewItem* cn = firstChild(); |
1233 | if ( cn ) { | 1228 | if ( cn ) { |
1234 | setCurrentItem ( cn ); | 1229 | setCurrentItem ( cn ); |
1235 | ensureItemVisible ( cn ); | 1230 | ensureItemVisible ( cn ); |
1236 | } | 1231 | } |
1237 | e->accept(); | 1232 | e->accept(); |
1238 | return; | 1233 | return; |
1239 | } | 1234 | } |
1240 | if ( e->state() == ControlButton ) { | 1235 | if ( e->state() == ControlButton ) { |
1241 | int count = childCount (); | 1236 | int count = childCount (); |
1242 | int jump = count / 5; | 1237 | int jump = count / 5; |
1243 | QListViewItem* cn; | 1238 | QListViewItem* cn; |
1244 | cn = currentItem(); | 1239 | cn = currentItem(); |
1245 | if ( ! cn ) | 1240 | if ( ! cn ) |
1246 | return; | 1241 | return; |
1247 | if ( jump == 0 ) | 1242 | if ( jump == 0 ) |
1248 | jump = 1; | 1243 | jump = 1; |
1249 | while ( jump && cn->itemAbove ()) { | 1244 | while ( jump && cn->itemAbove ()) { |
1250 | cn = cn->itemAbove (); | 1245 | cn = cn->itemAbove (); |
1251 | --jump; | 1246 | --jump; |
1252 | } | 1247 | } |
1253 | setCurrentItem ( cn ); | 1248 | setCurrentItem ( cn ); |
1254 | ensureItemVisible ( cn ); | 1249 | ensureItemVisible ( cn ); |
1255 | } else | 1250 | } else |
1256 | QListView::keyPressEvent ( e ) ; | 1251 | QListView::keyPressEvent ( e ) ; |
1257 | e->accept(); | 1252 | e->accept(); |
1258 | break; | 1253 | break; |
1259 | case Qt::Key_I: { | 1254 | case Qt::Key_I: { |
1260 | QListViewItem* cn; | 1255 | QListViewItem* cn; |
1261 | cn = currentItem(); | 1256 | cn = currentItem(); |
1262 | if ( cn ) { | 1257 | if ( cn ) { |
1263 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1258 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1264 | if ( ci ){ | 1259 | if ( ci ){ |
1265 | //emit showIncidence( ci->data()); | 1260 | //emit showIncidence( ci->data()); |
1266 | cn = cn->nextSibling(); | 1261 | cn = cn->nextSibling(); |
1267 | if ( cn ) { | 1262 | if ( cn ) { |
1268 | setCurrentItem ( cn ); | 1263 | setCurrentItem ( cn ); |
1269 | ensureItemVisible ( cn ); | 1264 | ensureItemVisible ( cn ); |
1270 | } | 1265 | } |
1271 | emit showIncidence( ci->data()); | 1266 | emit showIncidence( ci->data()); |
1272 | } | 1267 | } |
1273 | } | 1268 | } |
1274 | e->accept(); | 1269 | e->accept(); |
1275 | } | 1270 | } |
1276 | break; | 1271 | break; |
1277 | case Qt::Key_Return: | 1272 | case Qt::Key_Return: |
1278 | case Qt::Key_Enter: | 1273 | case Qt::Key_Enter: |
1279 | { | 1274 | { |
1280 | QListViewItem* cn; | 1275 | QListViewItem* cn; |
1281 | cn = currentItem(); | 1276 | cn = currentItem(); |
1282 | if ( cn ) { | 1277 | if ( cn ) { |
1283 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1278 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1284 | if ( ci ){ | 1279 | if ( ci ){ |
1285 | if ( e->state() == ShiftButton ) | 1280 | if ( e->state() == ShiftButton ) |
1286 | ci->setSelected( false ); | 1281 | ci->setSelected( false ); |
1287 | else | 1282 | else |
1288 | ci->setSelected( true ); | 1283 | ci->setSelected( true ); |
1289 | cn = cn->nextSibling(); | 1284 | cn = cn->nextSibling(); |
1290 | if ( cn ) { | 1285 | if ( cn ) { |
1291 | setCurrentItem ( cn ); | 1286 | setCurrentItem ( cn ); |
1292 | ensureItemVisible ( cn ); | 1287 | ensureItemVisible ( cn ); |
1293 | } | 1288 | } |
1294 | } | 1289 | } |
1295 | } | 1290 | } |
1296 | e->accept(); | 1291 | e->accept(); |
1297 | } | 1292 | } |
1298 | break; | 1293 | break; |
1299 | default: | 1294 | default: |
1300 | e->ignore(); | 1295 | e->ignore(); |
1301 | } | 1296 | } |
1302 | } | 1297 | } |
1303 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1298 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1304 | : KListView( lv, "kolistlistview", false ) | 1299 | : KListView( lv, "kolistlistview", false ) |
1305 | { | 1300 | { |
1306 | mYMousePos = 0; | 1301 | mYMousePos = 0; |
1307 | mPopupTimer = new QTimer(this); | 1302 | mPopupTimer = new QTimer(this); |
1308 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1303 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1309 | #ifndef DESKTOP_VERSION | 1304 | #ifndef DESKTOP_VERSION |
1310 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1305 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1311 | #endif | 1306 | #endif |
1312 | setSelectionMode( QListView::Multi ); | 1307 | setSelectionMode( QListView::Multi ); |
1313 | setMultiSelection( true); | 1308 | setMultiSelection( true); |
1314 | } | 1309 | } |
1315 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1310 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) |
1316 | { | 1311 | { |
1317 | QListViewItem *qitem = firstChild (); | 1312 | QListViewItem *qitem = firstChild (); |
1318 | while ( qitem ) { | 1313 | while ( qitem ) { |
1319 | if ( qitem->isSelected() && item != qitem ) | 1314 | if ( qitem->isSelected() && item != qitem ) |
1320 | return true; | 1315 | return true; |
1321 | qitem = qitem->nextSibling(); | 1316 | qitem = qitem->nextSibling(); |
1322 | } | 1317 | } |
1323 | return false; | 1318 | return false; |
1324 | } | 1319 | } |
1325 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1320 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1326 | { | 1321 | { |
1327 | if (!e) return; | 1322 | if (!e) return; |
1328 | QPoint vp = contentsToViewport(e->pos()); | 1323 | QPoint vp = contentsToViewport(e->pos()); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 77d0ac8..98a820d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,1252 +1,1255 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qtopia/alarmserver.h> | 27 | #include <qtopia/alarmserver.h> |
28 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
29 | #include <unistd.h> // for sleep | 29 | #include <unistd.h> // for sleep |
30 | #else | 30 | #else |
31 | #include <qtoolbar.h> | 31 | #include <qtoolbar.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <resource.h> | 33 | //#include <resource.h> |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | #include <libkcal/calendarlocal.h> | 36 | #include <libkcal/calendarlocal.h> |
37 | #include <libkcal/todo.h> | 37 | #include <libkcal/todo.h> |
38 | #include <libkcal/phoneformat.h> | 38 | #include <libkcal/phoneformat.h> |
39 | #include <libkdepim/ksyncprofile.h> | 39 | #include <libkdepim/ksyncprofile.h> |
40 | #include <libkdepim/phoneaccess.h> | 40 | #include <libkdepim/phoneaccess.h> |
41 | #include <libkcal/kincidenceformatter.h> | 41 | #include <libkcal/kincidenceformatter.h> |
42 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
43 | 43 | ||
44 | #include "calendarview.h" | 44 | #include "calendarview.h" |
45 | #include "koviewmanager.h" | 45 | #include "koviewmanager.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | #include "koagendaview.h" | 47 | #include "koagendaview.h" |
48 | #include "kojournalview.h" | 48 | #include "kojournalview.h" |
49 | #include "koagenda.h" | 49 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 52 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 55 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #include "kglobal.h" | 58 | #include "kglobal.h" |
59 | #include "ktoolbar.h" | 59 | #include "ktoolbar.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
63 | #include <kglobalsettings.h> | 63 | #include <kglobalsettings.h> |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | QPixmap* sgListViewCompletedPix[6]; | 131 | QPixmap* sgListViewCompletedPix[6]; |
132 | QPixmap* sgListViewJournalPix; | 132 | QPixmap* sgListViewJournalPix; |
133 | 133 | ||
134 | 134 | ||
135 | int globalFlagBlockStartup; | 135 | int globalFlagBlockStartup; |
136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
137 | QMainWindow( parent, name ) | 137 | QMainWindow( parent, name ) |
138 | { | 138 | { |
139 | sgListViewCompletedPix[5] = &listviewPix; | 139 | sgListViewCompletedPix[5] = &listviewPix; |
140 | sgListViewCompletedPix[0] = &listviewPix0; | 140 | sgListViewCompletedPix[0] = &listviewPix0; |
141 | sgListViewCompletedPix[1] = &listviewPix20; | 141 | sgListViewCompletedPix[1] = &listviewPix20; |
142 | sgListViewCompletedPix[2] = &listviewPix40; | 142 | sgListViewCompletedPix[2] = &listviewPix40; |
143 | sgListViewCompletedPix[3] = &listviewPix60; | 143 | sgListViewCompletedPix[3] = &listviewPix60; |
144 | sgListViewCompletedPix[4] = &listviewPix80; | 144 | sgListViewCompletedPix[4] = &listviewPix80; |
145 | //int size = 12; | 145 | //int size = 12; |
146 | { | 146 | { |
147 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 147 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
148 | sgListViewCompletedPix[5]->fill( Qt::white ); | 148 | sgListViewCompletedPix[5]->fill( Qt::white ); |
149 | QPainter p ( sgListViewCompletedPix[5] ); | 149 | QPainter p ( sgListViewCompletedPix[5] ); |
150 | p.drawRect( 0,0,11,11); | 150 | p.drawRect( 0,0,11,11); |
151 | p.drawLine ( 2, 5, 4 , 7 ) ; | 151 | p.drawLine ( 2, 5, 4 , 7 ) ; |
152 | p.drawLine ( 4 , 7 , 8, 3) ; | 152 | p.drawLine ( 4 , 7 , 8, 3) ; |
153 | int iii = 0; | 153 | int iii = 0; |
154 | for ( iii = 0; iii < 5; ++iii ) { | 154 | for ( iii = 0; iii < 5; ++iii ) { |
155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
156 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 156 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
157 | QPainter p ( sgListViewCompletedPix[iii] ); | 157 | QPainter p ( sgListViewCompletedPix[iii] ); |
158 | p.drawRect( 0,0,11,11); | 158 | p.drawRect( 0,0,11,11); |
159 | if ( iii ) | 159 | if ( iii ) |
160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
161 | } | 161 | } |
162 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
163 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
164 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
165 | { | 165 | { |
166 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
167 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
168 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | mClosed = false; | 173 | mClosed = false; |
174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 175 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 176 | QFileInfo finf ( confFile ); |
177 | bool showWarning = !finf.exists(); | 177 | bool showWarning = !finf.exists(); |
178 | setIcon(SmallIcon( "ko24" ) ); | 178 | setIcon(SmallIcon( "ko24" ) ); |
179 | mBlockAtStartup = true; | 179 | mBlockAtStartup = true; |
180 | mFlagKeyPressed = false; | 180 | mFlagKeyPressed = false; |
181 | setCaption("KO/Pi"); | 181 | setCaption("KO/Pi"); |
182 | KOPrefs *p = KOPrefs::instance(); | 182 | KOPrefs *p = KOPrefs::instance(); |
183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
184 | p->mCurrentDisplayedView = 0; | 184 | p->mCurrentDisplayedView = 0; |
185 | if ( p->mHourSize > 22 ) | 185 | if ( p->mHourSize > 22 ) |
186 | p->mHourSize = 22; | 186 | p->mHourSize = 22; |
187 | QMainWindow::ToolBarDock tbd; | 187 | QMainWindow::ToolBarDock tbd; |
188 | if ( p->mToolBarHor ) { | 188 | if ( p->mToolBarHor ) { |
189 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
190 | tbd = Bottom; | 190 | tbd = Bottom; |
191 | else | 191 | else |
192 | tbd = Top; | 192 | tbd = Top; |
193 | } | 193 | } |
194 | else { | 194 | else { |
195 | if ( p->mToolBarUp ) | 195 | if ( p->mToolBarUp ) |
196 | tbd = Right; | 196 | tbd = Right; |
197 | else | 197 | else |
198 | tbd = Left; | 198 | tbd = Left; |
199 | } | 199 | } |
200 | if ( KOPrefs::instance()->mUseAppColors ) | 200 | if ( KOPrefs::instance()->mUseAppColors ) |
201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
202 | globalFlagBlockStartup = 1; | 202 | globalFlagBlockStartup = 1; |
203 | iconToolBar = new QPEToolBar( this ); | 203 | iconToolBar = new QPEToolBar( this ); |
204 | addToolBar (iconToolBar , tbd ); | 204 | addToolBar (iconToolBar , tbd ); |
205 | 205 | ||
206 | #ifdef DESKTOP_VERSION | 206 | #ifdef DESKTOP_VERSION |
207 | if ( KOPrefs::instance()->mShowIconFilter ) | 207 | if ( KOPrefs::instance()->mShowIconFilter ) |
208 | #else | 208 | #else |
209 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 209 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | { | 212 | { |
213 | if ( p->mToolBarHorF ) { | 213 | if ( p->mToolBarHorF ) { |
214 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
215 | tbd = Bottom; | 215 | tbd = Bottom; |
216 | else | 216 | else |
217 | tbd = Top; | 217 | tbd = Top; |
218 | } | 218 | } |
219 | else { | 219 | else { |
220 | if ( p->mToolBarUpF ) | 220 | if ( p->mToolBarUpF ) |
221 | tbd = Right; | 221 | tbd = Right; |
222 | else | 222 | else |
223 | tbd = Left; | 223 | tbd = Left; |
224 | } | 224 | } |
225 | filterToolBar = new QPEToolBar ( this ); | 225 | filterToolBar = new QPEToolBar ( this ); |
226 | filterMenubar = new KMenuBar( 0 ); | 226 | filterMenubar = new KMenuBar( 0 ); |
227 | QFontMetrics fm ( filterMenubar->font() ); | 227 | QFontMetrics fm ( filterMenubar->font() ); |
228 | 228 | #ifndef DESKTOP_VERSION | |
229 | filterToolBar->setFocusPolicy( NoFocus ); | ||
230 | filterMenubar->setFocusPolicy( NoFocus ); | ||
231 | #endif | ||
229 | filterPopupMenu = new QPopupMenu( this ); | 232 | filterPopupMenu = new QPopupMenu( this ); |
230 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
231 | QString addTest = "A"; | 234 | QString addTest = "A"; |
232 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
233 | #ifdef DESKTOP_VERSION | 236 | #ifdef DESKTOP_VERSION |
234 | addTest = "AAABBBCCCx"; | 237 | addTest = "AAABBBCCCx"; |
235 | #else | 238 | #else |
236 | addTest = "AAx"; | 239 | addTest = "AAx"; |
237 | #endif | 240 | #endif |
238 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
239 | addToolBar (filterToolBar , tbd ); | 242 | addToolBar (filterToolBar , tbd ); |
240 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
241 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
242 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
243 | filterToolBar->hide(); | 246 | filterToolBar->hide(); |
244 | } else { | 247 | } else { |
245 | filterToolBar = 0; | 248 | filterToolBar = 0; |
246 | filterMenubar = 0; | 249 | filterMenubar = 0; |
247 | filterPopupMenu = 0; | 250 | filterPopupMenu = 0; |
248 | } | 251 | } |
249 | if ( p->mShowIconOnetoolbar ) { | 252 | if ( p->mShowIconOnetoolbar ) { |
250 | viewToolBar = iconToolBar ; | 253 | viewToolBar = iconToolBar ; |
251 | navigatorToolBar = iconToolBar ; | 254 | navigatorToolBar = iconToolBar ; |
252 | } else { | 255 | } else { |
253 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
254 | setToolBarsMovable( false ); | 257 | setToolBarsMovable( false ); |
255 | #endif | 258 | #endif |
256 | if ( p->mToolBarHorV ) { | 259 | if ( p->mToolBarHorV ) { |
257 | if ( p->mToolBarUpV ) | 260 | if ( p->mToolBarUpV ) |
258 | tbd = Bottom; | 261 | tbd = Bottom; |
259 | else | 262 | else |
260 | tbd = Top; | 263 | tbd = Top; |
261 | } | 264 | } |
262 | else { | 265 | else { |
263 | if ( p->mToolBarUpV ) | 266 | if ( p->mToolBarUpV ) |
264 | tbd = Right; | 267 | tbd = Right; |
265 | else | 268 | else |
266 | tbd = Left; | 269 | tbd = Left; |
267 | } | 270 | } |
268 | viewToolBar = new QPEToolBar( this ); | 271 | viewToolBar = new QPEToolBar( this ); |
269 | addToolBar (viewToolBar , tbd ); | 272 | addToolBar (viewToolBar , tbd ); |
270 | if ( p->mToolBarHorN ) { | 273 | if ( p->mToolBarHorN ) { |
271 | if ( p->mToolBarUpN ) | 274 | if ( p->mToolBarUpN ) |
272 | tbd = Bottom; | 275 | tbd = Bottom; |
273 | else | 276 | else |
274 | tbd = Top; | 277 | tbd = Top; |
275 | } | 278 | } |
276 | else { | 279 | else { |
277 | if ( p->mToolBarUpN ) | 280 | if ( p->mToolBarUpN ) |
278 | tbd = Right; | 281 | tbd = Right; |
279 | else | 282 | else |
280 | tbd = Left; | 283 | tbd = Left; |
281 | } | 284 | } |
282 | navigatorToolBar = new QPEToolBar( this ); | 285 | navigatorToolBar = new QPEToolBar( this ); |
283 | addToolBar (navigatorToolBar , tbd ); | 286 | addToolBar (navigatorToolBar , tbd ); |
284 | } | 287 | } |
285 | 288 | ||
286 | 289 | ||
287 | 290 | ||
288 | mCalendarModifiedFlag = false; | 291 | mCalendarModifiedFlag = false; |
289 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 292 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
290 | splash->setAlignment ( AlignCenter ); | 293 | splash->setAlignment ( AlignCenter ); |
291 | setCentralWidget( splash ); | 294 | setCentralWidget( splash ); |
292 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
293 | showMaximized(); | 296 | showMaximized(); |
294 | #endif | 297 | #endif |
295 | 298 | ||
296 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
297 | setDefaultPreferences(); | 300 | setDefaultPreferences(); |
298 | mCalendar = new CalendarLocal(); | 301 | mCalendar = new CalendarLocal(); |
299 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
300 | mView->hide(); | 303 | mView->hide(); |
301 | //mView->resize(splash->size() ); | 304 | //mView->resize(splash->size() ); |
302 | initActions(); | 305 | initActions(); |
303 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 306 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
304 | mSyncManager->setBlockSave(false); | 307 | mSyncManager->setBlockSave(false); |
305 | mView->setSyncManager(mSyncManager); | 308 | mView->setSyncManager(mSyncManager); |
306 | #ifndef DESKTOP_VERSION | 309 | #ifndef DESKTOP_VERSION |
307 | iconToolBar->show(); | 310 | iconToolBar->show(); |
308 | qApp->processEvents(); | 311 | qApp->processEvents(); |
309 | #endif | 312 | #endif |
310 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 313 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
311 | int vh = height() ; | 314 | int vh = height() ; |
312 | int vw = width(); | 315 | int vw = width(); |
313 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 316 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
314 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 317 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
315 | vh -= iconToolBar->height(); | 318 | vh -= iconToolBar->height(); |
316 | } else { | 319 | } else { |
317 | vw -= iconToolBar->height(); | 320 | vw -= iconToolBar->height(); |
318 | } | 321 | } |
319 | //mView->setMaximumSize( splash->size() ); | 322 | //mView->setMaximumSize( splash->size() ); |
320 | //mView->resize( splash->size() ); | 323 | //mView->resize( splash->size() ); |
321 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 324 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
322 | mView->readSettings(); | 325 | mView->readSettings(); |
323 | bool newFile = false; | 326 | bool newFile = false; |
324 | if( !QFile::exists( defaultFileName() ) ) { | 327 | if( !QFile::exists( defaultFileName() ) ) { |
325 | QFileInfo finfo ( defaultFileName() ); | 328 | QFileInfo finfo ( defaultFileName() ); |
326 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
327 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
328 | finfo.setFile( oldFile ); | 331 | finfo.setFile( oldFile ); |
329 | if (finfo.exists() ) { | 332 | if (finfo.exists() ) { |
330 | KMessageBox::information( this, message); | 333 | KMessageBox::information( this, message); |
331 | mView->openCalendar( oldFile ); | 334 | mView->openCalendar( oldFile ); |
332 | qApp->processEvents(); | 335 | qApp->processEvents(); |
333 | } else { | 336 | } else { |
334 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
335 | finfo.setFile( oldFile ); | 338 | finfo.setFile( oldFile ); |
336 | if (finfo.exists() ) { | 339 | if (finfo.exists() ) { |
337 | KMessageBox::information( this, message); | 340 | KMessageBox::information( this, message); |
338 | mView->openCalendar( oldFile ); | 341 | mView->openCalendar( oldFile ); |
339 | qApp->processEvents(); | 342 | qApp->processEvents(); |
340 | } | 343 | } |
341 | } | 344 | } |
342 | mView->saveCalendar( defaultFileName() ); | 345 | mView->saveCalendar( defaultFileName() ); |
343 | newFile = true; | 346 | newFile = true; |
344 | } | 347 | } |
345 | 348 | ||
346 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 349 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
347 | mView->loadCalendars(); | 350 | mView->loadCalendars(); |
348 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 351 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
349 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 352 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
350 | 353 | ||
351 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
352 | KOPrefs::instance()->setAllDefaults(); | 355 | KOPrefs::instance()->setAllDefaults(); |
353 | } | 356 | } |
354 | processIncidenceSelection( 0 ); | 357 | processIncidenceSelection( 0 ); |
355 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 358 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
356 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 359 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
357 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 360 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
358 | SLOT( slotModifiedChanged( bool ) ) ); | 361 | SLOT( slotModifiedChanged( bool ) ) ); |
359 | 362 | ||
360 | 363 | ||
361 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 364 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
362 | SLOT( disableBR(bool) ) ); | 365 | SLOT( disableBR(bool) ) ); |
363 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 366 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
364 | mView->setModified( false ); | 367 | mView->setModified( false ); |
365 | mBlockAtStartup = false; | 368 | mBlockAtStartup = false; |
366 | mView->setModified( false ); | 369 | mView->setModified( false ); |
367 | setCentralWidget( mView ); | 370 | setCentralWidget( mView ); |
368 | globalFlagBlockStartup = 0; | 371 | globalFlagBlockStartup = 0; |
369 | mView->show(); | 372 | mView->show(); |
370 | delete splash; | 373 | delete splash; |
371 | if ( newFile ) | 374 | if ( newFile ) |
372 | mView->updateConfig(); | 375 | mView->updateConfig(); |
373 | // qApp->processEvents(); | 376 | // qApp->processEvents(); |
374 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 377 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
375 | //fillSyncMenu(); | 378 | //fillSyncMenu(); |
376 | 379 | ||
377 | 380 | ||
378 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 381 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
379 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 382 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
380 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 383 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
381 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 384 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
382 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 385 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
383 | mSyncManager->setDefaultFileName( sentSyncFile()); | 386 | mSyncManager->setDefaultFileName( sentSyncFile()); |
384 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 387 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
385 | mSyncManager->fillSyncMenu(); | 388 | mSyncManager->fillSyncMenu(); |
386 | 389 | ||
387 | 390 | ||
388 | 391 | ||
389 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 392 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
390 | if ( showWarning ) { | 393 | if ( showWarning ) { |
391 | KMessageBox::information( this, | 394 | KMessageBox::information( this, |
392 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 395 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
393 | qApp->processEvents(); | 396 | qApp->processEvents(); |
394 | mView->dialogManager()->showSyncOptions(); | 397 | mView->dialogManager()->showSyncOptions(); |
395 | } | 398 | } |
396 | 399 | ||
397 | //US listen for result adressed from Ka/Pi | 400 | //US listen for result adressed from Ka/Pi |
398 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
399 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 402 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
400 | #endif | 403 | #endif |
401 | #ifndef DESKTOP_VERSION | 404 | #ifndef DESKTOP_VERSION |
402 | infrared = 0; | 405 | infrared = 0; |
403 | #endif | 406 | #endif |
404 | updateFilterToolbar(); | 407 | updateFilterToolbar(); |
405 | updateWeek( mView->startDate() ); | 408 | updateWeek( mView->startDate() ); |
406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 409 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 410 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
408 | mBRdisabled = false; | 411 | mBRdisabled = false; |
409 | //toggleBeamReceive(); | 412 | //toggleBeamReceive(); |
410 | 413 | ||
411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 414 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
412 | } | 415 | } |
413 | MainWindow::~MainWindow() | 416 | MainWindow::~MainWindow() |
414 | { | 417 | { |
415 | //qDebug("MainWindow::~MainWindow() "); | 418 | //qDebug("MainWindow::~MainWindow() "); |
416 | //save toolbar location | 419 | //save toolbar location |
417 | delete mCalendar; | 420 | delete mCalendar; |
418 | delete mSyncManager; | 421 | delete mSyncManager; |
419 | #ifndef DESKTOP_VERSION | 422 | #ifndef DESKTOP_VERSION |
420 | if ( infrared ) | 423 | if ( infrared ) |
421 | delete infrared; | 424 | delete infrared; |
422 | #endif | 425 | #endif |
423 | 426 | ||
424 | 427 | ||
425 | } | 428 | } |
426 | void MainWindow::slotResetFocus() | 429 | void MainWindow::slotResetFocus() |
427 | { | 430 | { |
428 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 431 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
429 | mFocusLoop = 3; | 432 | mFocusLoop = 3; |
430 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 433 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
431 | } | 434 | } |
432 | void MainWindow::slotResetFocusLoop() | 435 | void MainWindow::slotResetFocusLoop() |
433 | { | 436 | { |
434 | --mFocusLoop; | 437 | --mFocusLoop; |
435 | QWidget* fw = mView->viewManager()->currentView(); | 438 | QWidget* fw = mView->viewManager()->currentView(); |
436 | if ( fw ) { | 439 | if ( fw ) { |
437 | //qDebug("loop "); | 440 | //qDebug("loop "); |
438 | fw->setFocus(); | 441 | fw->setFocus(); |
439 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 442 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
440 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 443 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
441 | } | 444 | } |
442 | 445 | ||
443 | } | 446 | } |
444 | void MainWindow::disableBR(bool b) | 447 | void MainWindow::disableBR(bool b) |
445 | { | 448 | { |
446 | #ifndef DESKTOP_VERSION | 449 | #ifndef DESKTOP_VERSION |
447 | if ( b ) { | 450 | if ( b ) { |
448 | if ( infrared ) { | 451 | if ( infrared ) { |
449 | toggleBeamReceive(); | 452 | toggleBeamReceive(); |
450 | mBRdisabled = true; | 453 | mBRdisabled = true; |
451 | } | 454 | } |
452 | mBRdisabled = true; | 455 | mBRdisabled = true; |
453 | } else { | 456 | } else { |
454 | if ( mBRdisabled ) { | 457 | if ( mBRdisabled ) { |
455 | mBRdisabled = false; | 458 | mBRdisabled = false; |
456 | //makes no sense,because other cal ap is probably running | 459 | //makes no sense,because other cal ap is probably running |
457 | // toggleBeamReceive(); | 460 | // toggleBeamReceive(); |
458 | } | 461 | } |
459 | } | 462 | } |
460 | #endif | 463 | #endif |
461 | 464 | ||
462 | } | 465 | } |
463 | bool MainWindow::beamReceiveEnabled() | 466 | bool MainWindow::beamReceiveEnabled() |
464 | { | 467 | { |
465 | #ifndef DESKTOP_VERSION | 468 | #ifndef DESKTOP_VERSION |
466 | return ( infrared != 0 ); | 469 | return ( infrared != 0 ); |
467 | #endif | 470 | #endif |
468 | return false; | 471 | return false; |
469 | } | 472 | } |
470 | 473 | ||
471 | void MainWindow::toggleBeamReceive() | 474 | void MainWindow::toggleBeamReceive() |
472 | { | 475 | { |
473 | if ( mBRdisabled ) | 476 | if ( mBRdisabled ) |
474 | return; | 477 | return; |
475 | #ifndef DESKTOP_VERSION | 478 | #ifndef DESKTOP_VERSION |
476 | if ( infrared ) { | 479 | if ( infrared ) { |
477 | qDebug("KO: Disable BeamReceive "); | 480 | qDebug("KO: Disable BeamReceive "); |
478 | delete infrared; | 481 | delete infrared; |
479 | infrared = 0; | 482 | infrared = 0; |
480 | brAction->setOn(false); | 483 | brAction->setOn(false); |
481 | return; | 484 | return; |
482 | } | 485 | } |
483 | qDebug("KO: Enable BeamReceive "); | 486 | qDebug("KO: Enable BeamReceive "); |
484 | brAction->setOn(true); | 487 | brAction->setOn(true); |
485 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 488 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
486 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 489 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
487 | #endif | 490 | #endif |
488 | } | 491 | } |
489 | void MainWindow::showMaximized () | 492 | void MainWindow::showMaximized () |
490 | { | 493 | { |
491 | #ifndef DESKTOP_VERSION | 494 | #ifndef DESKTOP_VERSION |
492 | if ( ! globalFlagBlockStartup ) | 495 | if ( ! globalFlagBlockStartup ) |
493 | if ( mClosed ) | 496 | if ( mClosed ) |
494 | mView->goToday(); | 497 | mView->goToday(); |
495 | #endif | 498 | #endif |
496 | QWidget::showMaximized () ; | 499 | QWidget::showMaximized () ; |
497 | mClosed = false; | 500 | mClosed = false; |
498 | } | 501 | } |
499 | void MainWindow::closeEvent( QCloseEvent* ce ) | 502 | void MainWindow::closeEvent( QCloseEvent* ce ) |
500 | { | 503 | { |
501 | 504 | ||
502 | 505 | ||
503 | 506 | ||
504 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 507 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
505 | saveOnClose(); | 508 | saveOnClose(); |
506 | mClosed = true; | 509 | mClosed = true; |
507 | ce->accept(); | 510 | ce->accept(); |
508 | return; | 511 | return; |
509 | 512 | ||
510 | } | 513 | } |
511 | 514 | ||
512 | switch( QMessageBox::information( this, "KO/Pi", | 515 | switch( QMessageBox::information( this, "KO/Pi", |
513 | i18n("Do you really want\nto close KO/Pi?"), | 516 | i18n("Do you really want\nto close KO/Pi?"), |
514 | i18n("Close"), i18n("No"), | 517 | i18n("Close"), i18n("No"), |
515 | 0, 0 ) ) { | 518 | 0, 0 ) ) { |
516 | case 0: | 519 | case 0: |
517 | saveOnClose(); | 520 | saveOnClose(); |
518 | mClosed = true; | 521 | mClosed = true; |
519 | ce->accept(); | 522 | ce->accept(); |
520 | break; | 523 | break; |
521 | case 1: | 524 | case 1: |
522 | ce->ignore(); | 525 | ce->ignore(); |
523 | break; | 526 | break; |
524 | case 2: | 527 | case 2: |
525 | 528 | ||
526 | default: | 529 | default: |
527 | break; | 530 | break; |
528 | } | 531 | } |
529 | 532 | ||
530 | 533 | ||
531 | } | 534 | } |
532 | 535 | ||
533 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 536 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
534 | { | 537 | { |
535 | QDataStream stream( data, IO_ReadOnly ); | 538 | QDataStream stream( data, IO_ReadOnly ); |
536 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 539 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
537 | //QString datamess; | 540 | //QString datamess; |
538 | //qDebug("message "); | 541 | //qDebug("message "); |
539 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 542 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
540 | 543 | ||
541 | if ( cmsg == "setDocument(QString)" ) { | 544 | if ( cmsg == "setDocument(QString)" ) { |
542 | QDataStream stream( data, IO_ReadOnly ); | 545 | QDataStream stream( data, IO_ReadOnly ); |
543 | QString fileName; | 546 | QString fileName; |
544 | stream >> fileName; | 547 | stream >> fileName; |
545 | //qDebug("filename %s ", fileName.latin1()); | 548 | //qDebug("filename %s ", fileName.latin1()); |
546 | showMaximized(); | 549 | showMaximized(); |
547 | raise(); | 550 | raise(); |
548 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 551 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
549 | mSyncManager->slotSyncMenu( 1002 ); | 552 | mSyncManager->slotSyncMenu( 1002 ); |
550 | return; | 553 | return; |
551 | } | 554 | } |
552 | 555 | ||
553 | if ( cmsg == "-writeFile" ) { | 556 | if ( cmsg == "-writeFile" ) { |
554 | // I made from the "-writeFile" an "-writeAlarm" | 557 | // I made from the "-writeFile" an "-writeAlarm" |
555 | mView->viewManager()->showWhatsNextView(); | 558 | mView->viewManager()->showWhatsNextView(); |
556 | mCalendar->checkAlarmForIncidence( 0, true); | 559 | mCalendar->checkAlarmForIncidence( 0, true); |
557 | showMaximized(); | 560 | showMaximized(); |
558 | raise(); | 561 | raise(); |
559 | return; | 562 | return; |
560 | 563 | ||
561 | } | 564 | } |
562 | if ( cmsg == "-writeFileSilent" ) { | 565 | if ( cmsg == "-writeFileSilent" ) { |
563 | // I made from the "-writeFile" an "-writeAlarm" | 566 | // I made from the "-writeFile" an "-writeAlarm" |
564 | // mView->viewManager()->showWhatsNextView(); | 567 | // mView->viewManager()->showWhatsNextView(); |
565 | mCalendar->checkAlarmForIncidence( 0, true); | 568 | mCalendar->checkAlarmForIncidence( 0, true); |
566 | //showMaximized(); | 569 | //showMaximized(); |
567 | //raise(); | 570 | //raise(); |
568 | hide(); | 571 | hide(); |
569 | return; | 572 | return; |
570 | } | 573 | } |
571 | if ( cmsg == "-newCountdown" ) { | 574 | if ( cmsg == "-newCountdown" ) { |
572 | qDebug("newCountdown "); | 575 | qDebug("newCountdown "); |
573 | 576 | ||
574 | } | 577 | } |
575 | QString msg ; | 578 | QString msg ; |
576 | QString allmsg = cmsg; | 579 | QString allmsg = cmsg; |
577 | while ( allmsg.length() > 0 ) { | 580 | while ( allmsg.length() > 0 ) { |
578 | int nextC = allmsg.find( "-", 1 ); | 581 | int nextC = allmsg.find( "-", 1 ); |
579 | if ( nextC == -1 ) { | 582 | if ( nextC == -1 ) { |
580 | msg = allmsg; | 583 | msg = allmsg; |
581 | allmsg = ""; | 584 | allmsg = ""; |
582 | } else{ | 585 | } else{ |
583 | msg = allmsg.left( nextC ); | 586 | msg = allmsg.left( nextC ); |
584 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 587 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
585 | } | 588 | } |
586 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 589 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
587 | if ( msg == "-newEvent" ) { | 590 | if ( msg == "-newEvent" ) { |
588 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 591 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
589 | } | 592 | } |
590 | if ( msg == "-newTodo" ) { | 593 | if ( msg == "-newTodo" ) { |
591 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 594 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
592 | } | 595 | } |
593 | if ( msg == "-showWN" ) { | 596 | if ( msg == "-showWN" ) { |
594 | mView->viewManager()->showWhatsNextView(); | 597 | mView->viewManager()->showWhatsNextView(); |
595 | } | 598 | } |
596 | if ( msg == "-showTodo" ) { | 599 | if ( msg == "-showTodo" ) { |
597 | mView->viewManager()->showTodoView(); | 600 | mView->viewManager()->showTodoView(); |
598 | } | 601 | } |
599 | if ( msg == "-showList" ) { | 602 | if ( msg == "-showList" ) { |
600 | mView->viewManager()->showListView(); | 603 | mView->viewManager()->showListView(); |
601 | } | 604 | } |
602 | else if ( msg == "-showDay" ) { | 605 | else if ( msg == "-showDay" ) { |
603 | mView->viewManager()->showDayView(); | 606 | mView->viewManager()->showDayView(); |
604 | } | 607 | } |
605 | else if ( msg == "-showWWeek" ) { | 608 | else if ( msg == "-showWWeek" ) { |
606 | mView->viewManager()->showWorkWeekView(); | 609 | mView->viewManager()->showWorkWeekView(); |
607 | } | 610 | } |
608 | else if ( msg == "-ringSync" ) { | 611 | else if ( msg == "-ringSync" ) { |
609 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 612 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
610 | } | 613 | } |
611 | else if ( msg == "-showWeek" ) { | 614 | else if ( msg == "-showWeek" ) { |
612 | mView->viewManager()->showWeekView(); | 615 | mView->viewManager()->showWeekView(); |
613 | } | 616 | } |
614 | else if ( msg == "-showTodo" ) { | 617 | else if ( msg == "-showTodo" ) { |
615 | mView->viewManager()->showTodoView(); | 618 | mView->viewManager()->showTodoView(); |
616 | } | 619 | } |
617 | else if ( msg == "-showJournal" ) { | 620 | else if ( msg == "-showJournal" ) { |
618 | mView->dateNavigator()->selectDates( 1 ); | 621 | mView->dateNavigator()->selectDates( 1 ); |
619 | mView->dateNavigator()->selectToday(); | 622 | mView->dateNavigator()->selectToday(); |
620 | mView->viewManager()->showJournalView(); | 623 | mView->viewManager()->showJournalView(); |
621 | } | 624 | } |
622 | else if ( msg == "-showKO" ) { | 625 | else if ( msg == "-showKO" ) { |
623 | mView->viewManager()->showNextXView(); | 626 | mView->viewManager()->showNextXView(); |
624 | } | 627 | } |
625 | else if ( msg == "-showWNext" ) { | 628 | else if ( msg == "-showWNext" ) { |
626 | mView->viewManager()->showWhatsNextView(); | 629 | mView->viewManager()->showWhatsNextView(); |
627 | } | 630 | } |
628 | else if ( msg == "nextView()" ) { | 631 | else if ( msg == "nextView()" ) { |
629 | mView->viewManager()->showNextView(); | 632 | mView->viewManager()->showNextView(); |
630 | } | 633 | } |
631 | else if ( msg == "-showNextXView" ) { | 634 | else if ( msg == "-showNextXView" ) { |
632 | mView->viewManager()->showNextXView(); | 635 | mView->viewManager()->showNextXView(); |
633 | } | 636 | } |
634 | 637 | ||
635 | 638 | ||
636 | } | 639 | } |
637 | 640 | ||
638 | showMaximized(); | 641 | showMaximized(); |
639 | raise(); | 642 | raise(); |
640 | } | 643 | } |
641 | void MainWindow::startMultiSync() | 644 | void MainWindow::startMultiSync() |
642 | { | 645 | { |
643 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 646 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
644 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 647 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
645 | question, | 648 | question, |
646 | i18n("Yes"), i18n("No"), | 649 | i18n("Yes"), i18n("No"), |
647 | 0, 0 ) != 0 ) { | 650 | 0, 0 ) != 0 ) { |
648 | setCaption(i18n("Aborted! Nothing synced!")); | 651 | setCaption(i18n("Aborted! Nothing synced!")); |
649 | return; | 652 | return; |
650 | } | 653 | } |
651 | mSyncManager->multiSync( false ); | 654 | mSyncManager->multiSync( false ); |
652 | #ifndef DESKTOP_VERSION | 655 | #ifndef DESKTOP_VERSION |
653 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 656 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
654 | #endif | 657 | #endif |
655 | } | 658 | } |
656 | QPixmap MainWindow::loadPixmap( QString name ) | 659 | QPixmap MainWindow::loadPixmap( QString name ) |
657 | { | 660 | { |
658 | return SmallIcon( name ); | 661 | return SmallIcon( name ); |
659 | 662 | ||
660 | } | 663 | } |
661 | void MainWindow::setUsesBigPixmaps ( bool b ) | 664 | void MainWindow::setUsesBigPixmaps ( bool b ) |
662 | { | 665 | { |
663 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 666 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
664 | if ( b ) | 667 | if ( b ) |
665 | qDebug("KO: BigPixmaps are not supported "); | 668 | qDebug("KO: BigPixmaps are not supported "); |
666 | } | 669 | } |
667 | void MainWindow::initActions() | 670 | void MainWindow::initActions() |
668 | { | 671 | { |
669 | //KOPrefs::instance()->mShowFullMenu | 672 | //KOPrefs::instance()->mShowFullMenu |
670 | iconToolBar->clear(); | 673 | iconToolBar->clear(); |
671 | KOPrefs *p = KOPrefs::instance(); | 674 | KOPrefs *p = KOPrefs::instance(); |
672 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 675 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
673 | 676 | ||
674 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 677 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
675 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 678 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
676 | mCurrentItemMenu = new QPopupMenu ( this ); | 679 | mCurrentItemMenu = new QPopupMenu ( this ); |
677 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 680 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
678 | QPopupMenu *importMenu = new QPopupMenu( this ); | 681 | QPopupMenu *importMenu = new QPopupMenu( this ); |
679 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 682 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
680 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 683 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
681 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 684 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
682 | selectFilterMenu = new QPopupMenu( this ); | 685 | selectFilterMenu = new QPopupMenu( this ); |
683 | selectFilterMenu->setCheckable( true ); | 686 | selectFilterMenu->setCheckable( true ); |
684 | syncMenu = new QPopupMenu( this ); | 687 | syncMenu = new QPopupMenu( this ); |
685 | configureAgendaMenu = new QPopupMenu( this ); | 688 | configureAgendaMenu = new QPopupMenu( this ); |
686 | configureToolBarMenu = new QPopupMenu( this ); | 689 | configureToolBarMenu = new QPopupMenu( this ); |
687 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 690 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
688 | QIconSet icon; | 691 | QIconSet icon; |
689 | int pixWid = 22, pixHei = 22; | 692 | int pixWid = 22, pixHei = 22; |
690 | QString pathString = ""; | 693 | QString pathString = ""; |
691 | if ( !p->mToolBarMiniIcons ) { | 694 | if ( !p->mToolBarMiniIcons ) { |
692 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 695 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
693 | pathString += "icons16/"; | 696 | pathString += "icons16/"; |
694 | pixWid = 18; pixHei = 16; | 697 | pixWid = 18; pixHei = 16; |
695 | } | 698 | } |
696 | } else { | 699 | } else { |
697 | pathString += "iconsmini/"; | 700 | pathString += "iconsmini/"; |
698 | pixWid = 18; pixHei = 16; | 701 | pixWid = 18; pixHei = 16; |
699 | } | 702 | } |
700 | 703 | ||
701 | if ( KOPrefs::instance()->mShowFullMenu ) { | 704 | if ( KOPrefs::instance()->mShowFullMenu ) { |
702 | menuBar1 = new KMenuBar( this );//menuBar(); | 705 | menuBar1 = new KMenuBar( this );//menuBar(); |
703 | //setMenuBar( menuBar1 ); | 706 | //setMenuBar( menuBar1 ); |
704 | menuBar1->show(); | 707 | menuBar1->show(); |
705 | menuBar1->insertItem( i18n("File"), importMenu ); | 708 | menuBar1->insertItem( i18n("File"), importMenu ); |
706 | menuBar1->insertItem( i18n("View"), viewMenu ); | 709 | menuBar1->insertItem( i18n("View"), viewMenu ); |
707 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 710 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
708 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 711 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
709 | #ifdef DESKTOP_VERSION | 712 | #ifdef DESKTOP_VERSION |
710 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 713 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
711 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 714 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
712 | #else | 715 | #else |
713 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 716 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
714 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 717 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
715 | #endif | 718 | #endif |
716 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 719 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
717 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 720 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
718 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 721 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
719 | } else { | 722 | } else { |
720 | menuBar1 = new KMenuBar( iconToolBar ); | 723 | menuBar1 = new KMenuBar( iconToolBar ); |
721 | QPopupMenu *menuBar = new QPopupMenu( this ); | 724 | QPopupMenu *menuBar = new QPopupMenu( this ); |
722 | icon = loadPixmap( pathString + "z_menu" ); | 725 | icon = loadPixmap( pathString + "z_menu" ); |
723 | menuBar1->insertItem( icon.pixmap(), menuBar); | 726 | menuBar1->insertItem( icon.pixmap(), menuBar); |
724 | //menuBar1->insertItem( i18n("ME"), menuBar); | 727 | //menuBar1->insertItem( i18n("ME"), menuBar); |
725 | menuBar->insertItem( i18n("File"), importMenu ); | 728 | menuBar->insertItem( i18n("File"), importMenu ); |
726 | menuBar->insertItem( i18n("View"), viewMenu ); | 729 | menuBar->insertItem( i18n("View"), viewMenu ); |
727 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 730 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
728 | menuBar->insertItem( i18n("Action"), actionMenu ); | 731 | menuBar->insertItem( i18n("Action"), actionMenu ); |
729 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 732 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
730 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 733 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
731 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 734 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
732 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 735 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
733 | menuBar->insertItem( i18n("Help"), helpMenu ); | 736 | menuBar->insertItem( i18n("Help"), helpMenu ); |
734 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 737 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
735 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 738 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
736 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); | 739 | connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); |
737 | } | 740 | } |
738 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 741 | connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
739 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); | 742 | //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); |
740 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 743 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
741 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 744 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
742 | 745 | ||
743 | 746 | ||
744 | mWeekBgColor = iconToolBar->backgroundColor(); | 747 | mWeekBgColor = iconToolBar->backgroundColor(); |
745 | mWeekPixmap.resize( pixWid , pixHei ); | 748 | mWeekPixmap.resize( pixWid , pixHei ); |
746 | mWeekPixmap.fill( mWeekBgColor ); | 749 | mWeekPixmap.fill( mWeekBgColor ); |
747 | icon = mWeekPixmap; | 750 | icon = mWeekPixmap; |
748 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 751 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
749 | if ( p-> mShowIconWeekNum ) | 752 | if ( p-> mShowIconWeekNum ) |
750 | mWeekAction->addTo( iconToolBar ); | 753 | mWeekAction->addTo( iconToolBar ); |
751 | mWeekFont = font(); | 754 | mWeekFont = font(); |
752 | 755 | ||
753 | int fontPoint = mWeekFont.pointSize(); | 756 | int fontPoint = mWeekFont.pointSize(); |
754 | QFontMetrics f( mWeekFont ); | 757 | QFontMetrics f( mWeekFont ); |
755 | int fontWid = f.width( "30" ); | 758 | int fontWid = f.width( "30" ); |
756 | while ( fontWid > pixWid ) { | 759 | while ( fontWid > pixWid ) { |
757 | --fontPoint; | 760 | --fontPoint; |
758 | mWeekFont.setPointSize( fontPoint ); | 761 | mWeekFont.setPointSize( fontPoint ); |
759 | QFontMetrics f( mWeekFont ); | 762 | QFontMetrics f( mWeekFont ); |
760 | fontWid = f.width( "30" ); | 763 | fontWid = f.width( "30" ); |
761 | //qDebug("dec-- "); | 764 | //qDebug("dec-- "); |
762 | } | 765 | } |
763 | 766 | ||
764 | connect( mWeekAction, SIGNAL( activated() ), | 767 | connect( mWeekAction, SIGNAL( activated() ), |
765 | this, SLOT( weekAction() ) ); | 768 | this, SLOT( weekAction() ) ); |
766 | 769 | ||
767 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 770 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
768 | if ( p->mShowIconFilterview ) { | 771 | if ( p->mShowIconFilterview ) { |
769 | icon = loadPixmap( pathString + "filter" ); | 772 | icon = loadPixmap( pathString + "filter" ); |
770 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 773 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
771 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 774 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
772 | this, SLOT( fillFilterMenuTB() ) ); | 775 | this, SLOT( fillFilterMenuTB() ) ); |
773 | actionFilterMenuTB->addTo( iconToolBar ); | 776 | actionFilterMenuTB->addTo( iconToolBar ); |
774 | selectFilterMenuTB = new QPopupMenu( this ); | 777 | selectFilterMenuTB = new QPopupMenu( this ); |
775 | selectFilterMenuTB->setCheckable( true ); | 778 | selectFilterMenuTB->setCheckable( true ); |
776 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 779 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
777 | } | 780 | } |
778 | 781 | ||
779 | //#endif | 782 | //#endif |
780 | // ****************** | 783 | // ****************** |
781 | QAction *action; | 784 | QAction *action; |
782 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 785 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
783 | configureToolBarMenu->setCheckable( true ); | 786 | configureToolBarMenu->setCheckable( true ); |
784 | 787 | ||
785 | 788 | ||
786 | configureAgendaMenu->setCheckable( true ); | 789 | configureAgendaMenu->setCheckable( true ); |
787 | int iii ; | 790 | int iii ; |
788 | for ( iii = 1;iii<= 10 ;++iii ){ | 791 | for ( iii = 1;iii<= 10 ;++iii ){ |
789 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 792 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
790 | } | 793 | } |
791 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 794 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
792 | 795 | ||
793 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 796 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
794 | this, SLOT( showConfigureAgenda( ) ) ); | 797 | this, SLOT( showConfigureAgenda( ) ) ); |
795 | icon = loadPixmap( pathString + "today" ); | 798 | icon = loadPixmap( pathString + "today" ); |
796 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 799 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
797 | today_action->addTo( actionMenu ); | 800 | today_action->addTo( actionMenu ); |
798 | connect( today_action, SIGNAL( activated() ), | 801 | connect( today_action, SIGNAL( activated() ), |
799 | mView, SLOT( goToday() ) ); | 802 | mView, SLOT( goToday() ) ); |
800 | 803 | ||
801 | icon = loadPixmap( pathString + "picker" ); | 804 | icon = loadPixmap( pathString + "picker" ); |
802 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); | 805 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); |
803 | dPickerAction->addTo( actionMenu ); | 806 | dPickerAction->addTo( actionMenu ); |
804 | connect( dPickerAction, SIGNAL( activated() ), | 807 | connect( dPickerAction, SIGNAL( activated() ), |
805 | mView, SLOT( showDatePicker() ) ); | 808 | mView, SLOT( showDatePicker() ) ); |
806 | 809 | ||
807 | icon = loadPixmap( pathString + "search" ); | 810 | icon = loadPixmap( pathString + "search" ); |
808 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 811 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
809 | search_action->addTo( actionMenu ); | 812 | search_action->addTo( actionMenu ); |
810 | connect( search_action, SIGNAL( activated() ), | 813 | connect( search_action, SIGNAL( activated() ), |
811 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 814 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
812 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); | 815 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); |
813 | 816 | ||
814 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); | 817 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); |
815 | action->addTo( nextConflictMenu ); | 818 | action->addTo( nextConflictMenu ); |
816 | connect( action, SIGNAL( activated() ), | 819 | connect( action, SIGNAL( activated() ), |
817 | mView, SLOT( conflictAll() ) ); | 820 | mView, SLOT( conflictAll() ) ); |
818 | 821 | ||
819 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); | 822 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); |
820 | action->addTo( nextConflictMenu ); | 823 | action->addTo( nextConflictMenu ); |
821 | connect( action, SIGNAL( activated() ), | 824 | connect( action, SIGNAL( activated() ), |
822 | mView, SLOT( conflictAllday() ) ); | 825 | mView, SLOT( conflictAllday() ) ); |
823 | 826 | ||
824 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); | 827 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); |
825 | action->addTo( nextConflictMenu ); | 828 | action->addTo( nextConflictMenu ); |
826 | connect( action, SIGNAL( activated() ), | 829 | connect( action, SIGNAL( activated() ), |
827 | mView, SLOT( conflictNotAll() ) ); | 830 | mView, SLOT( conflictNotAll() ) ); |
828 | 831 | ||
829 | actionMenu->insertSeparator(); | 832 | actionMenu->insertSeparator(); |
830 | 833 | ||
831 | icon = loadPixmap( pathString + "newevent" ); | 834 | icon = loadPixmap( pathString + "newevent" ); |
832 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 835 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
833 | ne_action->addTo( mCurrentItemMenu ); | 836 | ne_action->addTo( mCurrentItemMenu ); |
834 | connect( ne_action, SIGNAL( activated() ), | 837 | connect( ne_action, SIGNAL( activated() ), |
835 | mView, SLOT( newEvent() ) ); | 838 | mView, SLOT( newEvent() ) ); |
836 | icon = loadPixmap( pathString + "newtodo" ); | 839 | icon = loadPixmap( pathString + "newtodo" ); |
837 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 840 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
838 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 841 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
839 | nt_action->addTo( mCurrentItemMenu ); | 842 | nt_action->addTo( mCurrentItemMenu ); |
840 | connect( nt_action, SIGNAL( activated() ), | 843 | connect( nt_action, SIGNAL( activated() ), |
841 | mView, SLOT( newTodo() ) ); | 844 | mView, SLOT( newTodo() ) ); |
842 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 845 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
843 | this ); | 846 | this ); |
844 | mNewSubTodoAction->addTo( mCurrentItemMenu ); | 847 | mNewSubTodoAction->addTo( mCurrentItemMenu ); |
845 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 848 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
846 | mView, SLOT( newSubTodo() ) ); | 849 | mView, SLOT( newSubTodo() ) ); |
847 | 850 | ||
848 | mCurrentItemMenu->insertSeparator(); | 851 | mCurrentItemMenu->insertSeparator(); |
849 | icon = loadPixmap( pathString + "newevent" ); | 852 | icon = loadPixmap( pathString + "newevent" ); |
850 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 853 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
851 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 854 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
852 | configureToolBarMenu->insertSeparator(); | 855 | configureToolBarMenu->insertSeparator(); |
853 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 856 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
854 | configureToolBarMenu->insertSeparator(); | 857 | configureToolBarMenu->insertSeparator(); |
855 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 858 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
856 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 859 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
857 | 860 | ||
858 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 861 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
859 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); | 862 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
860 | mShowAction->addTo( mCurrentItemMenu ); | 863 | mShowAction->addTo( mCurrentItemMenu ); |
861 | connect( mShowAction, SIGNAL( activated() ), | 864 | connect( mShowAction, SIGNAL( activated() ), |
862 | mView, SLOT( showIncidence() ) ); | 865 | mView, SLOT( showIncidence() ) ); |
863 | 866 | ||
864 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 867 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
865 | mEditAction->addTo( mCurrentItemMenu ); | 868 | mEditAction->addTo( mCurrentItemMenu ); |
866 | connect( mEditAction, SIGNAL( activated() ), | 869 | connect( mEditAction, SIGNAL( activated() ), |
867 | mView, SLOT( editIncidence() ) ); | 870 | mView, SLOT( editIncidence() ) ); |
868 | 871 | ||
869 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 872 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
870 | mDeleteAction->addTo( mCurrentItemMenu ); | 873 | mDeleteAction->addTo( mCurrentItemMenu ); |
871 | connect( mDeleteAction, SIGNAL( activated() ), | 874 | connect( mDeleteAction, SIGNAL( activated() ), |
872 | mView, SLOT( deleteIncidence() ) ); | 875 | mView, SLOT( deleteIncidence() ) ); |
873 | 876 | ||
874 | 877 | ||
875 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 878 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
876 | mCloneAction->addTo( mCurrentItemMenu ); | 879 | mCloneAction->addTo( mCurrentItemMenu ); |
877 | connect( mCloneAction, SIGNAL( activated() ), | 880 | connect( mCloneAction, SIGNAL( activated() ), |
878 | mView, SLOT( cloneIncidence() ) ); | 881 | mView, SLOT( cloneIncidence() ) ); |
879 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 882 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
880 | mMoveAction->addTo( mCurrentItemMenu ); | 883 | mMoveAction->addTo( mCurrentItemMenu ); |
881 | connect( mMoveAction, SIGNAL( activated() ), | 884 | connect( mMoveAction, SIGNAL( activated() ), |
882 | mView, SLOT( moveIncidence() ) ); | 885 | mView, SLOT( moveIncidence() ) ); |
883 | #ifndef DESKTOP_VERSION | 886 | #ifndef DESKTOP_VERSION |
884 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 887 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
885 | mBeamAction->addTo(mCurrentItemMenu ); | 888 | mBeamAction->addTo(mCurrentItemMenu ); |
886 | connect( mBeamAction, SIGNAL( activated() ), | 889 | connect( mBeamAction, SIGNAL( activated() ), |
887 | mView, SLOT( beamIncidence() ) ); | 890 | mView, SLOT( beamIncidence() ) ); |
888 | #endif | 891 | #endif |
889 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 892 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
890 | mCancelAction->addTo( mCurrentItemMenu ); | 893 | mCancelAction->addTo( mCurrentItemMenu ); |
891 | connect( mCancelAction, SIGNAL( activated() ), | 894 | connect( mCancelAction, SIGNAL( activated() ), |
892 | mView, SLOT( toggleCancelIncidence() ) ); | 895 | mView, SLOT( toggleCancelIncidence() ) ); |
893 | 896 | ||
894 | 897 | ||
895 | mCurrentItemMenu->insertSeparator(); | 898 | mCurrentItemMenu->insertSeparator(); |
896 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 899 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
897 | action->addTo( mCurrentItemMenu ); | 900 | action->addTo( mCurrentItemMenu ); |
898 | connect( action, SIGNAL( activated() ), | 901 | connect( action, SIGNAL( activated() ), |
899 | mView, SLOT( undo_delete() ) ); | 902 | mView, SLOT( undo_delete() ) ); |
900 | 903 | ||
901 | // *********************** | 904 | // *********************** |
902 | if ( KOPrefs::instance()->mVerticalScreen ) { | 905 | if ( KOPrefs::instance()->mVerticalScreen ) { |
903 | icon = SmallIcon( "1updownarrow" ); | 906 | icon = SmallIcon( "1updownarrow" ); |
904 | } else { | 907 | } else { |
905 | icon = SmallIcon("1leftrightarrow" ); | 908 | icon = SmallIcon("1leftrightarrow" ); |
906 | } | 909 | } |
907 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 910 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
908 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 911 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
909 | FSaction->addTo( viewMenu ); | 912 | FSaction->addTo( viewMenu ); |
910 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 913 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
911 | 914 | ||
912 | 915 | ||
913 | icon = loadPixmap( pathString + "filter" ); | 916 | icon = loadPixmap( pathString + "filter" ); |
914 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 917 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
915 | icon = loadPixmap( pathString + "configure" ); | 918 | icon = loadPixmap( pathString + "configure" ); |
916 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 919 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
917 | action->addTo( viewMenu ); | 920 | action->addTo( viewMenu ); |
918 | connect( action, SIGNAL( activated() ), | 921 | connect( action, SIGNAL( activated() ), |
919 | mView, SLOT( toggleFilter() ) ); | 922 | mView, SLOT( toggleFilter() ) ); |
920 | mToggleFilter = action; | 923 | mToggleFilter = action; |
921 | icon = loadPixmap( pathString + "navi" ); | 924 | icon = loadPixmap( pathString + "navi" ); |
922 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 925 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
923 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 926 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
924 | action->addTo( viewMenu ); | 927 | action->addTo( viewMenu ); |
925 | connect( action, SIGNAL( activated() ), | 928 | connect( action, SIGNAL( activated() ), |
926 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 929 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
927 | mToggleNav = action ; | 930 | mToggleNav = action ; |
928 | icon = loadPixmap( pathString + "allday" ); | 931 | icon = loadPixmap( pathString + "allday" ); |
929 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 932 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
930 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 933 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
931 | action->addTo( viewMenu ); | 934 | action->addTo( viewMenu ); |
932 | connect( action, SIGNAL( activated() ), | 935 | connect( action, SIGNAL( activated() ), |
933 | mView, SLOT( toggleAllDaySize() ) ); | 936 | mView, SLOT( toggleAllDaySize() ) ); |
934 | mToggleAllday = action; | 937 | mToggleAllday = action; |
935 | 938 | ||
936 | 939 | ||
937 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 940 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
938 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 941 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
939 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 942 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
940 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 943 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
941 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 944 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
942 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 945 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
943 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 946 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
944 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 947 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
945 | 948 | ||
946 | 949 | ||
947 | dPickerAction->addTo( iconToolBar ); | 950 | dPickerAction->addTo( iconToolBar ); |
948 | viewMenu->insertSeparator(); | 951 | viewMenu->insertSeparator(); |
949 | 952 | ||
950 | if ( p-> mShowIconToggleFull ) | 953 | if ( p-> mShowIconToggleFull ) |
951 | FSaction->addTo( iconToolBar ); | 954 | FSaction->addTo( iconToolBar ); |
952 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 955 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
953 | 956 | ||
954 | //******************** | 957 | //******************** |
955 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 958 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
956 | 959 | ||
957 | 960 | ||
958 | icon = loadPixmap( pathString + "whatsnext" ); | 961 | icon = loadPixmap( pathString + "whatsnext" ); |
959 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 962 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
960 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 963 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
961 | whatsnext_action->addTo( viewMenu ); | 964 | whatsnext_action->addTo( viewMenu ); |
962 | connect( whatsnext_action, SIGNAL( activated() ), | 965 | connect( whatsnext_action, SIGNAL( activated() ), |
963 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 966 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
964 | 967 | ||
965 | icon = loadPixmap( pathString + "xdays" ); | 968 | icon = loadPixmap( pathString + "xdays" ); |
966 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 969 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
967 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 970 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
968 | xdays_action->addTo( viewMenu ); | 971 | xdays_action->addTo( viewMenu ); |
969 | connect( xdays_action, SIGNAL( activated() ), | 972 | connect( xdays_action, SIGNAL( activated() ), |
970 | mView->viewManager(), SLOT( showNextXView() ) ); | 973 | mView->viewManager(), SLOT( showNextXView() ) ); |
971 | 974 | ||
972 | 975 | ||
973 | icon = loadPixmap( pathString + "journal" ); | 976 | icon = loadPixmap( pathString + "journal" ); |
974 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 977 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
975 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 978 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
976 | viewjournal_action->addTo( viewMenu ); | 979 | viewjournal_action->addTo( viewMenu ); |
977 | connect( viewjournal_action, SIGNAL( activated() ), | 980 | connect( viewjournal_action, SIGNAL( activated() ), |
978 | mView->viewManager(), SLOT( showJournalView() ) ); | 981 | mView->viewManager(), SLOT( showJournalView() ) ); |
979 | 982 | ||
980 | 983 | ||
981 | icon = loadPixmap( pathString + "day" ); | 984 | icon = loadPixmap( pathString + "day" ); |
982 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 985 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
983 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 986 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
984 | day1_action->addTo( viewMenu ); | 987 | day1_action->addTo( viewMenu ); |
985 | // action->addTo( toolBar ); | 988 | // action->addTo( toolBar ); |
986 | connect( day1_action, SIGNAL( activated() ), | 989 | connect( day1_action, SIGNAL( activated() ), |
987 | mView->viewManager(), SLOT( showDayView() ) ); | 990 | mView->viewManager(), SLOT( showDayView() ) ); |
988 | 991 | ||
989 | icon = loadPixmap( pathString + "workweek" ); | 992 | icon = loadPixmap( pathString + "workweek" ); |
990 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 993 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
991 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 994 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
992 | day5_action->addTo( viewMenu ); | 995 | day5_action->addTo( viewMenu ); |
993 | connect( day5_action, SIGNAL( activated() ), | 996 | connect( day5_action, SIGNAL( activated() ), |
994 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 997 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
995 | 998 | ||
996 | icon = loadPixmap( pathString + "week" ); | 999 | icon = loadPixmap( pathString + "week" ); |
997 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 1000 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
998 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 1001 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
999 | day7_action->addTo( viewMenu ); | 1002 | day7_action->addTo( viewMenu ); |
1000 | connect( day7_action, SIGNAL( activated() ), | 1003 | connect( day7_action, SIGNAL( activated() ), |
1001 | mView->viewManager(), SLOT( showWeekView() ) ); | 1004 | mView->viewManager(), SLOT( showWeekView() ) ); |
1002 | 1005 | ||
1003 | icon = loadPixmap( pathString + "workweek2" ); | 1006 | icon = loadPixmap( pathString + "workweek2" ); |
1004 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 1007 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
1005 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 1008 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
1006 | day6_action->addTo( viewMenu ); | 1009 | day6_action->addTo( viewMenu ); |
1007 | connect( day6_action, SIGNAL( activated() ), | 1010 | connect( day6_action, SIGNAL( activated() ), |
1008 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 1011 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
1009 | 1012 | ||
1010 | icon = loadPixmap( pathString + "month" ); | 1013 | icon = loadPixmap( pathString + "month" ); |
1011 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 1014 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
1012 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 1015 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
1013 | month_action->addTo( viewMenu ); | 1016 | month_action->addTo( viewMenu ); |
1014 | connect( month_action, SIGNAL( activated() ), | 1017 | connect( month_action, SIGNAL( activated() ), |
1015 | mView->viewManager(), SLOT( showMonthView() ) ); | 1018 | mView->viewManager(), SLOT( showMonthView() ) ); |
1016 | 1019 | ||
1017 | icon = loadPixmap( pathString + "list" ); | 1020 | icon = loadPixmap( pathString + "list" ); |
1018 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 1021 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
1019 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 1022 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
1020 | showlist_action->addTo( viewMenu ); | 1023 | showlist_action->addTo( viewMenu ); |
1021 | connect( showlist_action, SIGNAL( activated() ), | 1024 | connect( showlist_action, SIGNAL( activated() ), |
1022 | mView->viewManager(), SLOT( showListView() ) ); | 1025 | mView->viewManager(), SLOT( showListView() ) ); |
1023 | 1026 | ||
1024 | icon = loadPixmap( pathString + "todo" ); | 1027 | icon = loadPixmap( pathString + "todo" ); |
1025 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1028 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1026 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1029 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1027 | todoview_action->addTo( viewMenu ); | 1030 | todoview_action->addTo( viewMenu ); |
1028 | connect( todoview_action, SIGNAL( activated() ), | 1031 | connect( todoview_action, SIGNAL( activated() ), |
1029 | mView->viewManager(), SLOT( showTodoView() ) ); | 1032 | mView->viewManager(), SLOT( showTodoView() ) ); |
1030 | 1033 | ||
1031 | 1034 | ||
1032 | 1035 | ||
1033 | #if 0 | 1036 | #if 0 |
1034 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1037 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1035 | action->addTo( viewMenu ); | 1038 | action->addTo( viewMenu ); |
1036 | connect( action, SIGNAL( activated() ), | 1039 | connect( action, SIGNAL( activated() ), |
1037 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1040 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1038 | #endif | 1041 | #endif |
1039 | 1042 | ||
1040 | 1043 | ||
1041 | 1044 | ||
1042 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1045 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1043 | this ); | 1046 | this ); |
1044 | action->addTo( actionMenu ); | 1047 | action->addTo( actionMenu ); |
1045 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1048 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1046 | 1049 | ||
1047 | 1050 | ||
1048 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1051 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1049 | 1052 | ||
1050 | 1053 | ||
1051 | 1054 | ||
1052 | actionMenu->insertSeparator(); | 1055 | actionMenu->insertSeparator(); |
1053 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1056 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1054 | this ); | 1057 | this ); |
1055 | action->addTo( actionMenu ); | 1058 | action->addTo( actionMenu ); |
1056 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1059 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1057 | 1060 | ||
1058 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1061 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1059 | this ); | 1062 | this ); |
1060 | action->addTo( actionMenu ); | 1063 | action->addTo( actionMenu ); |
1061 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1064 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1062 | 1065 | ||
1063 | 1066 | ||
1064 | actionMenu->insertSeparator(); | 1067 | actionMenu->insertSeparator(); |
1065 | icon = loadPixmap( pathString + "configure" ); | 1068 | icon = loadPixmap( pathString + "configure" ); |
1066 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1069 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1067 | action->addTo( actionMenu ); | 1070 | action->addTo( actionMenu ); |
1068 | connect( action, SIGNAL( activated() ), | 1071 | connect( action, SIGNAL( activated() ), |
1069 | mView, SLOT( edit_options() ) ); | 1072 | mView, SLOT( edit_options() ) ); |
1070 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1073 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1071 | action->addTo( actionMenu ); | 1074 | action->addTo( actionMenu ); |
1072 | connect( action, SIGNAL( activated() ), | 1075 | connect( action, SIGNAL( activated() ), |
1073 | this, SLOT( calHint() ) ); | 1076 | this, SLOT( calHint() ) ); |
1074 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1077 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1075 | action->addTo( actionMenu ); | 1078 | action->addTo( actionMenu ); |
1076 | connect( action, SIGNAL( activated() ), | 1079 | connect( action, SIGNAL( activated() ), |
1077 | mView, SLOT( edit_global_options() ) ); | 1080 | mView, SLOT( edit_global_options() ) ); |
1078 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1081 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1079 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1082 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1080 | 1083 | ||
1081 | } | 1084 | } |
1082 | // actionMenu->insertSeparator(); | 1085 | // actionMenu->insertSeparator(); |
1083 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1086 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1084 | this ); | 1087 | this ); |
1085 | action->addTo( importMenu_X ); | 1088 | action->addTo( importMenu_X ); |
1086 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1089 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1087 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1090 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1088 | this ); | 1091 | this ); |
1089 | action->addTo( importMenu_X ); | 1092 | action->addTo( importMenu_X ); |
1090 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1093 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1091 | importMenu_X->insertSeparator(); | 1094 | importMenu_X->insertSeparator(); |
1092 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1095 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1093 | this ); | 1096 | this ); |
1094 | action->addTo( importMenu_X ); | 1097 | action->addTo( importMenu_X ); |
1095 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1098 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1096 | //#ifndef DESKTOP_VERSION | 1099 | //#ifndef DESKTOP_VERSION |
1097 | importMenu_X->insertSeparator(); | 1100 | importMenu_X->insertSeparator(); |
1098 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1101 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1099 | this ); | 1102 | this ); |
1100 | action->addTo( importMenu_X ); | 1103 | action->addTo( importMenu_X ); |
1101 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1104 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1102 | //#else | 1105 | //#else |
1103 | #ifdef _OL_IMPORT_ | 1106 | #ifdef _OL_IMPORT_ |
1104 | importMenu_X->insertSeparator(); | 1107 | importMenu_X->insertSeparator(); |
1105 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1108 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1106 | this ); | 1109 | this ); |
1107 | action->addTo( importMenu_X ); | 1110 | action->addTo( importMenu_X ); |
1108 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1111 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1109 | #endif | 1112 | #endif |
1110 | //#endif | 1113 | //#endif |
1111 | 1114 | ||
1112 | //importMenu->insertSeparator(); | 1115 | //importMenu->insertSeparator(); |
1113 | #if 0 | 1116 | #if 0 |
1114 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1117 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1115 | this ); | 1118 | this ); |
1116 | action->addTo( importMenu ); | 1119 | action->addTo( importMenu ); |
1117 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1120 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1118 | #endif | 1121 | #endif |
1119 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1122 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1120 | this ); | 1123 | this ); |
1121 | action->addTo( importMenu ); | 1124 | action->addTo( importMenu ); |
1122 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1125 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1123 | importMenu->insertSeparator(); | 1126 | importMenu->insertSeparator(); |
1124 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1127 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1125 | //importMenu->insertSeparator(); | 1128 | //importMenu->insertSeparator(); |
1126 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1129 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1127 | this ); | 1130 | this ); |
1128 | action->addTo( exportMenu_X ); | 1131 | action->addTo( exportMenu_X ); |
1129 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1132 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1130 | 1133 | ||
1131 | 1134 | ||
1132 | //LR | 1135 | //LR |
1133 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1136 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1134 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1137 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1135 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1138 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1136 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1139 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1137 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1140 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1138 | 1141 | ||
1139 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1142 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1140 | mPrintSelAction = 0; | 1143 | mPrintSelAction = 0; |
1141 | #ifndef DESKTOP_VERSION | 1144 | #ifndef DESKTOP_VERSION |
1142 | //importMenu->insertSeparator(); | 1145 | //importMenu->insertSeparator(); |
1143 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1146 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1144 | this ); | 1147 | this ); |
1145 | brAction->addTo( beamMenu_X ); | 1148 | brAction->addTo( beamMenu_X ); |
1146 | brAction->setToggleAction (true ) ; | 1149 | brAction->setToggleAction (true ) ; |
1147 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1150 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1148 | 1151 | ||
1149 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1152 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1150 | this ); | 1153 | this ); |
1151 | action->addTo( beamMenu_X ); | 1154 | action->addTo( beamMenu_X ); |
1152 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1155 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1153 | 1156 | ||
1154 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1157 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1155 | this ); | 1158 | this ); |
1156 | action->addTo( beamMenu_X ); | 1159 | action->addTo( beamMenu_X ); |
1157 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1160 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1158 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1161 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1159 | #else | 1162 | #else |
1160 | //importMenu->insertSeparator(); | 1163 | //importMenu->insertSeparator(); |
1161 | icon = loadPixmap( pathString + "print" ); | 1164 | icon = loadPixmap( pathString + "print" ); |
1162 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1165 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1163 | action->addTo( beamMenu_X ); | 1166 | action->addTo( beamMenu_X ); |
1164 | connect( action, SIGNAL( activated() ), | 1167 | connect( action, SIGNAL( activated() ), |
1165 | this, SLOT( printCal() ) ); | 1168 | this, SLOT( printCal() ) ); |
1166 | 1169 | ||
1167 | icon = loadPixmap( pathString + "week" ); | 1170 | icon = loadPixmap( pathString + "week" ); |
1168 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1171 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1169 | action->addTo( beamMenu_X ); | 1172 | action->addTo( beamMenu_X ); |
1170 | connect( action, SIGNAL( activated() ), | 1173 | connect( action, SIGNAL( activated() ), |
1171 | this, SLOT( printSel() ) ); | 1174 | this, SLOT( printSel() ) ); |
1172 | icon = loadPixmap( pathString + "whatsnext" ); | 1175 | icon = loadPixmap( pathString + "whatsnext" ); |
1173 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1176 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1174 | action->addTo( beamMenu_X ); | 1177 | action->addTo( beamMenu_X ); |
1175 | connect( action, SIGNAL( activated() ), | 1178 | connect( action, SIGNAL( activated() ), |
1176 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1179 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1177 | 1180 | ||
1178 | 1181 | ||
1179 | icon = loadPixmap( pathString + "list" ); | 1182 | icon = loadPixmap( pathString + "list" ); |
1180 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1183 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1181 | action->addTo( beamMenu_X ); | 1184 | action->addTo( beamMenu_X ); |
1182 | connect( action, SIGNAL( activated() ), | 1185 | connect( action, SIGNAL( activated() ), |
1183 | this, SLOT( printListView() ) ); | 1186 | this, SLOT( printListView() ) ); |
1184 | 1187 | ||
1185 | icon = loadPixmap( pathString + "newevent" ); | 1188 | icon = loadPixmap( pathString + "newevent" ); |
1186 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1189 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1187 | action->addTo( beamMenu_X ); | 1190 | action->addTo( beamMenu_X ); |
1188 | connect( action, SIGNAL( activated() ), | 1191 | connect( action, SIGNAL( activated() ), |
1189 | mView, SLOT( slotprintSelInc() ) ); | 1192 | mView, SLOT( slotprintSelInc() ) ); |
1190 | mPrintSelAction = action; | 1193 | mPrintSelAction = action; |
1191 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1194 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1192 | #endif | 1195 | #endif |
1193 | 1196 | ||
1194 | importMenu->insertSeparator(); | 1197 | importMenu->insertSeparator(); |
1195 | action = new QAction( "beam all", i18n("Save"), 0, | 1198 | action = new QAction( "beam all", i18n("Save"), 0, |
1196 | this ); | 1199 | this ); |
1197 | action->addTo( importMenu ); | 1200 | action->addTo( importMenu ); |
1198 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1201 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1199 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1202 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1200 | this ); | 1203 | this ); |
1201 | action->addTo( importMenu ); | 1204 | action->addTo( importMenu ); |
1202 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1205 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1203 | 1206 | ||
1204 | //menuBar->insertItem( "Configure",configureMenu ); | 1207 | //menuBar->insertItem( "Configure",configureMenu ); |
1205 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1208 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1206 | icon = loadPixmap( "korganizer/korganizer" ); | 1209 | icon = loadPixmap( "korganizer/korganizer" ); |
1207 | 1210 | ||
1208 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1211 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1209 | action->addTo( helpMenu ); | 1212 | action->addTo( helpMenu ); |
1210 | connect( action, SIGNAL( activated() ), | 1213 | connect( action, SIGNAL( activated() ), |
1211 | SLOT( whatsNew() ) ); | 1214 | SLOT( whatsNew() ) ); |
1212 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1215 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1213 | action->addTo( helpMenu ); | 1216 | action->addTo( helpMenu ); |
1214 | connect( action, SIGNAL( activated() ), | 1217 | connect( action, SIGNAL( activated() ), |
1215 | SLOT( features() ) ); | 1218 | SLOT( features() ) ); |
1216 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1219 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1217 | action->addTo( helpMenu ); | 1220 | action->addTo( helpMenu ); |
1218 | connect( action, SIGNAL( activated() ), | 1221 | connect( action, SIGNAL( activated() ), |
1219 | SLOT( keyBindings() ) ); | 1222 | SLOT( keyBindings() ) ); |
1220 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1223 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1221 | action->addTo( helpMenu ); | 1224 | action->addTo( helpMenu ); |
1222 | connect( action, SIGNAL( activated() ), | 1225 | connect( action, SIGNAL( activated() ), |
1223 | SLOT( storagehowto() ) ); | 1226 | SLOT( storagehowto() ) ); |
1224 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1227 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1225 | action->addTo( helpMenu ); | 1228 | action->addTo( helpMenu ); |
1226 | connect( action, SIGNAL( activated() ), | 1229 | connect( action, SIGNAL( activated() ), |
1227 | SLOT( timetrackinghowto() ) ); | 1230 | SLOT( timetrackinghowto() ) ); |
1228 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1231 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1229 | action->addTo( helpMenu ); | 1232 | action->addTo( helpMenu ); |
1230 | connect( action, SIGNAL( activated() ), | 1233 | connect( action, SIGNAL( activated() ), |
1231 | SLOT( synchowto() ) ); | 1234 | SLOT( synchowto() ) ); |
1232 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1235 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1233 | action->addTo( helpMenu ); | 1236 | action->addTo( helpMenu ); |
1234 | connect( action, SIGNAL( activated() ), | 1237 | connect( action, SIGNAL( activated() ), |
1235 | SLOT( kdesynchowto() ) ); | 1238 | SLOT( kdesynchowto() ) ); |
1236 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1239 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1237 | action->addTo( helpMenu ); | 1240 | action->addTo( helpMenu ); |
1238 | connect( action, SIGNAL( activated() ), | 1241 | connect( action, SIGNAL( activated() ), |
1239 | SLOT( multisynchowto() ) ); | 1242 | SLOT( multisynchowto() ) ); |
1240 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1243 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1241 | action->addTo( helpMenu ); | 1244 | action->addTo( helpMenu ); |
1242 | connect( action, SIGNAL( activated() ), | 1245 | connect( action, SIGNAL( activated() ), |
1243 | SLOT( aboutAutoSaving() ) ); | 1246 | SLOT( aboutAutoSaving() ) ); |
1244 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1247 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1245 | action->addTo( helpMenu ); | 1248 | action->addTo( helpMenu ); |
1246 | connect( action, SIGNAL( activated() ), | 1249 | connect( action, SIGNAL( activated() ), |
1247 | SLOT( aboutKnownBugs() ) ); | 1250 | SLOT( aboutKnownBugs() ) ); |
1248 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1251 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1249 | action->addTo( helpMenu ); | 1252 | action->addTo( helpMenu ); |
1250 | connect( action, SIGNAL( activated() ), | 1253 | connect( action, SIGNAL( activated() ), |
1251 | SLOT( usertrans() ) ); | 1254 | SLOT( usertrans() ) ); |
1252 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1255 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |