author | zautrix <zautrix> | 2005-07-28 10:38:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-28 10:38:58 (UTC) |
commit | fee4c893fe8fd01af1b55c1ccd40213fc18a36b4 (patch) (unidiff) | |
tree | 83a3018d54d60e880d441a6f91ef8fe54254aaff /korganizer | |
parent | 27ffa2e08ebb38e71f613af3a214750442418e2c (diff) | |
download | kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.zip kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.gz kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.bz2 |
fixxxx
-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,315 +1,314 @@ | |||
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); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e7a5e0e..e560ce4 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,496 +1,491 @@ | |||
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; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 77d0ac8..98a820d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -36,385 +36,388 @@ | |||
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 ) |