author | zautrix <zautrix> | 2005-06-30 11:54:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 11:54:09 (UTC) |
commit | 13eb32c82e736b033435e596111b7b0f3fe75608 (patch) (unidiff) | |
tree | eef906423ff08d368b6a803e6d8ae4b919936ca3 /korganizer | |
parent | b03b54ce54c1391db8979db0df1369e1c68656fa (diff) | |
download | kdepimpi-13eb32c82e736b033435e596111b7b0f3fe75608.zip kdepimpi-13eb32c82e736b033435e596111b7b0f3fe75608.tar.gz kdepimpi-13eb32c82e736b033435e596111b7b0f3fe75608.tar.bz2 |
fixx
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 5 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 50a04ea..5c94f62 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -66,207 +66,206 @@ KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | |||
66 | KOEditorGeneral::~KOEditorGeneral() | 66 | KOEditorGeneral::~KOEditorGeneral() |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 70 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
71 | { | 71 | { |
72 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 72 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
73 | 73 | ||
74 | #if 0 | 74 | #if 0 |
75 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 75 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
76 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 76 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 79 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
80 | headerLayout->addWidget(summaryLabel,1,0); | 80 | headerLayout->addWidget(summaryLabel,1,0); |
81 | 81 | ||
82 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 82 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
83 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 83 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
84 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 84 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
85 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 85 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
86 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 86 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
87 | if ( QApplication::desktop()->width() > 320 ) | 87 | if ( QApplication::desktop()->width() > 320 ) |
88 | mSummaryEdit->setMaximumHeight( hei +6 ); | 88 | mSummaryEdit->setMaximumHeight( hei +6 ); |
89 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 89 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
90 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 90 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
91 | // mSummaryEdit = new QLineEdit(parent); | 91 | // mSummaryEdit = new QLineEdit(parent); |
92 | headerLayout->addWidget(mSummaryEdit,1,1); | 92 | headerLayout->addWidget(mSummaryEdit,1,1); |
93 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 93 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
94 | 94 | ||
95 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 95 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
96 | if ( QApplication::desktop()->height() < 320 ) | 96 | if ( QApplication::desktop()->height() < 320 ) |
97 | headerLayout->addWidget(locationLabel,1,2); | 97 | headerLayout->addWidget(locationLabel,1,2); |
98 | else | 98 | else |
99 | headerLayout->addWidget(locationLabel,2,0); | 99 | headerLayout->addWidget(locationLabel,2,0); |
100 | 100 | ||
101 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 101 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
102 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 102 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
103 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) | 103 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) |
104 | mLocationEdit->setMaximumHeight( hei + 6); | 104 | mLocationEdit->setMaximumHeight( hei + 6); |
105 | 105 | ||
106 | // mLocationEdit = new QLineEdit(parent); | 106 | // mLocationEdit = new QLineEdit(parent); |
107 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 107 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
108 | if ( QApplication::desktop()->height() < 320 ) { | 108 | if ( QApplication::desktop()->height() < 320 ) { |
109 | headerLayout->addWidget(mLocationEdit,1,3); | 109 | headerLayout->addWidget(mLocationEdit,1,3); |
110 | headerLayout->setColStretch( 1, 10); | 110 | headerLayout->setColStretch( 1, 10); |
111 | headerLayout->setColStretch( 3, 10); | 111 | headerLayout->setColStretch( 3, 10); |
112 | } | 112 | } |
113 | else { | 113 | else { |
114 | headerLayout->addWidget(mLocationEdit,2,1); | 114 | headerLayout->addWidget(mLocationEdit,2,1); |
115 | headerLayout->setColStretch( 1, 10); | 115 | headerLayout->setColStretch( 1, 10); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | void KOEditorGeneral::setFocusOn( int i ) | 118 | void KOEditorGeneral::setFocusOn( int i ) |
119 | { | 119 | { |
120 | mNextFocus = i; | 120 | mNextFocus = i; |
121 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 121 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
122 | } | 122 | } |
123 | void KOEditorGeneral::slotSetFocusOn() | 123 | void KOEditorGeneral::slotSetFocusOn() |
124 | { | 124 | { |
125 | mNextFocus; | 125 | mNextFocus; |
126 | if ( mNextFocus == 1 ) { | 126 | if ( mNextFocus == 1 ) { |
127 | mDescriptionEdit->setFocus(); | 127 | mDescriptionEdit->setFocus(); |
128 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 128 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
129 | } | 129 | } |
130 | if ( mNextFocus == 2 ) { | 130 | if ( mNextFocus == 2 ) { |
131 | mSummaryEdit->setFocus(); | 131 | mSummaryEdit->setFocus(); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | void KOEditorGeneral::editCategories() | 134 | void KOEditorGeneral::editCategories() |
135 | { | 135 | { |
136 | // qDebug("KOEditorGeneral::editCategories() "); | 136 | // qDebug("KOEditorGeneral::editCategories() "); |
137 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 137 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
138 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 138 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
139 | //KOGlobals::fitDialogToScreen( csd ); | 139 | //KOGlobals::fitDialogToScreen( csd ); |
140 | csd->setColorEnabled(); | 140 | csd->setColorEnabled(); |
141 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 141 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
142 | csd->exec(); | 142 | csd->exec(); |
143 | delete csd; | 143 | delete csd; |
144 | } | 144 | } |
145 | 145 | ||
146 | void KOEditorGeneral::showCatPopup() | 146 | void KOEditorGeneral::showCatPopup() |
147 | { | 147 | { |
148 | mCatPopup->clear(); | 148 | mCatPopup->clear(); |
149 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 149 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
150 | int index = 0; | 150 | int index = 0; |
151 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 151 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
152 | it != KOPrefs::instance()->mCustomCategories.end (); | 152 | it != KOPrefs::instance()->mCustomCategories.end (); |
153 | ++it) { | 153 | ++it) { |
154 | mCatPopup->insertItem (*it, index ); | 154 | mCatPopup->insertItem (*it, index ); |
155 | //mCategory[index] = *it; | 155 | //mCategory[index] = *it; |
156 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | 156 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); |
157 | ++index; | 157 | ++index; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | void KOEditorGeneral::selectedCatPopup( int index ) | 160 | void KOEditorGeneral::selectedCatPopup( int index ) |
161 | { | 161 | { |
162 | qDebug("i %d c %d ", index, KOPrefs::instance()->mCustomCategories.count()); | ||
163 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | 162 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); |
164 | QString colcat = categories.first(); | 163 | QString colcat = categories.first(); |
165 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 164 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
166 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 165 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
167 | else | 166 | else |
168 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 167 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |
169 | categories.sort (); | 168 | categories.sort (); |
170 | if ( !colcat.isEmpty() ) { | 169 | if ( !colcat.isEmpty() ) { |
171 | if ( categories.find ( colcat ) != categories.end () ) { | 170 | if ( categories.find ( colcat ) != categories.end () ) { |
172 | categories.remove( colcat ); | 171 | categories.remove( colcat ); |
173 | categories.prepend( colcat ); | 172 | categories.prepend( colcat ); |
174 | } | 173 | } |
175 | } | 174 | } |
176 | mCategoriesLabel->setText( categories.join(",") ); | 175 | setCategories( categories.join(",") ); |
177 | } | 176 | } |
178 | 177 | ||
179 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 178 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
180 | { | 179 | { |
181 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 180 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
182 | mCatPopup = new QPopupMenu ( parent ); | 181 | mCatPopup = new QPopupMenu ( parent ); |
183 | mCatPopup->setCheckable (true); | 182 | mCatPopup->setCheckable (true); |
184 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 183 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
185 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 184 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
186 | mCategoriesButton = new QPushButton(parent); | 185 | mCategoriesButton = new QPushButton(parent); |
187 | mCategoriesButton->setText(i18n("Categories")); | 186 | mCategoriesButton->setText(i18n("Categories")); |
188 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 187 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
189 | categoriesLayout->addWidget(mCategoriesButton); | 188 | categoriesLayout->addWidget(mCategoriesButton); |
190 | mCategoriesButton->setPopup( mCatPopup ); | 189 | mCategoriesButton->setPopup( mCatPopup ); |
191 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); | 190 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
192 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 191 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
193 | connect(mCategoriesLabel,SIGNAL(clicked()),this, SLOT(editCategories() )); | 192 | connect(mCategoriesLabel,SIGNAL(clicked()),this, SLOT(editCategories() )); |
194 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 193 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
195 | categoriesLayout->addWidget(mCategoriesLabel,1); | 194 | categoriesLayout->addWidget(mCategoriesLabel,1); |
196 | } | 195 | } |
197 | 196 | ||
198 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 197 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
199 | { | 198 | { |
200 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 199 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
201 | 200 | ||
202 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 201 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
203 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 202 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
204 | secrecyLayout->addWidget(mCancelBox); | 203 | secrecyLayout->addWidget(mCancelBox); |
205 | secrecyLayout->addWidget(secrecyLabel); | 204 | secrecyLayout->addWidget(secrecyLabel); |
206 | 205 | ||
207 | mSecrecyCombo = new QComboBox(parent); | 206 | mSecrecyCombo = new QComboBox(parent); |
208 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 207 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
209 | secrecyLayout->addWidget(mSecrecyCombo); | 208 | secrecyLayout->addWidget(mSecrecyCombo); |
210 | } | 209 | } |
211 | 210 | ||
212 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 211 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
213 | { | 212 | { |
214 | mDescriptionEdit = new KTextEdit(parent); | 213 | mDescriptionEdit = new KTextEdit(parent); |
215 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 214 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
216 | mDescriptionEdit->append(""); | 215 | mDescriptionEdit->append(""); |
217 | mDescriptionEdit->setReadOnly(false); | 216 | mDescriptionEdit->setReadOnly(false); |
218 | mDescriptionEdit->setOverwriteMode(false); | 217 | mDescriptionEdit->setOverwriteMode(false); |
219 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 218 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
220 | topLayout->addWidget(mDescriptionEdit); | 219 | topLayout->addWidget(mDescriptionEdit); |
221 | #ifndef DESKTOP_VERSION | 220 | #ifndef DESKTOP_VERSION |
222 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 221 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
223 | #endif | 222 | #endif |
224 | 223 | ||
225 | } | 224 | } |
226 | 225 | ||
227 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 226 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) |
228 | { | 227 | { |
229 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 228 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); |
230 | 229 | ||
231 | //mAlarmBell = new QLabel(parent); | 230 | //mAlarmBell = new QLabel(parent); |
232 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 231 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
233 | //alarmLayout->addWidget(mAlarmBell); | 232 | //alarmLayout->addWidget(mAlarmBell); |
234 | if ( QApplication::desktop()->width() < 320 ) | 233 | if ( QApplication::desktop()->width() < 320 ) |
235 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 234 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
236 | else | 235 | else |
237 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 236 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
238 | 237 | ||
239 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); | 238 | connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); |
240 | alarmLayout->addWidget(mAlarmButton); | 239 | alarmLayout->addWidget(mAlarmButton); |
241 | 240 | ||
242 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 241 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
243 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); | 242 | mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); |
244 | alarmLayout->addWidget(mAlarmTimeEdit); | 243 | alarmLayout->addWidget(mAlarmTimeEdit); |
245 | mAlarmIncrCombo = new QComboBox(false, parent); | 244 | mAlarmIncrCombo = new QComboBox(false, parent); |
246 | if ( QApplication::desktop()->width() < 320 ) { | 245 | if ( QApplication::desktop()->width() < 320 ) { |
247 | mAlarmIncrCombo->insertItem(i18n("min")); | 246 | mAlarmIncrCombo->insertItem(i18n("min")); |
248 | mAlarmIncrCombo->insertItem(i18n("hou")); | 247 | mAlarmIncrCombo->insertItem(i18n("hou")); |
249 | mAlarmIncrCombo->insertItem(i18n("day")); | 248 | mAlarmIncrCombo->insertItem(i18n("day")); |
250 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); | 249 | mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); |
251 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); | 250 | mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); |
252 | } else { | 251 | } else { |
253 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 252 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
254 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 253 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
255 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 254 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
256 | } | 255 | } |
257 | 256 | ||
258 | // mAlarmIncrCombo->setMinimumHeight(20); | 257 | // mAlarmIncrCombo->setMinimumHeight(20); |
259 | alarmLayout->addWidget(mAlarmIncrCombo); | 258 | alarmLayout->addWidget(mAlarmIncrCombo); |
260 | mAlarmSoundButton = new QPushButton(parent); | 259 | mAlarmSoundButton = new QPushButton(parent); |
261 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 260 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
262 | mAlarmSoundButton->setToggleButton(true); | 261 | mAlarmSoundButton->setToggleButton(true); |
263 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 262 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
264 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 263 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
265 | alarmLayout->addWidget(mAlarmSoundButton); | 264 | alarmLayout->addWidget(mAlarmSoundButton); |
266 | 265 | ||
267 | mAlarmProgramButton = new QPushButton(parent); | 266 | mAlarmProgramButton = new QPushButton(parent); |
268 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 267 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
269 | mAlarmProgramButton->setToggleButton(true); | 268 | mAlarmProgramButton->setToggleButton(true); |
270 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 269 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
271 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 270 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
272 | alarmLayout->addWidget(mAlarmProgramButton); | 271 | alarmLayout->addWidget(mAlarmProgramButton); |
@@ -305,192 +304,194 @@ void KOEditorGeneral::pickAlarmSound() | |||
305 | if (mAlarmProgramButton->isOn()) | 304 | if (mAlarmProgramButton->isOn()) |
306 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 305 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
307 | if ( mAlarmSoundButton->isOn()) | 306 | if ( mAlarmSoundButton->isOn()) |
308 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 307 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
309 | 308 | ||
310 | } | 309 | } |
311 | 310 | ||
312 | void KOEditorGeneral::pickAlarmProgram() | 311 | void KOEditorGeneral::pickAlarmProgram() |
313 | { | 312 | { |
314 | bool oldState = mAlarmProgramButton->isOn(); | 313 | bool oldState = mAlarmProgramButton->isOn(); |
315 | 314 | ||
316 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 315 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
317 | if (!fileName.isEmpty()) { | 316 | if (!fileName.isEmpty()) { |
318 | mAlarmProgram = fileName; | 317 | mAlarmProgram = fileName; |
319 | QToolTip::remove(mAlarmProgramButton); | 318 | QToolTip::remove(mAlarmProgramButton); |
320 | QString dispStr = i18n("Running '%1'").arg(fileName); | 319 | QString dispStr = i18n("Running '%1'").arg(fileName); |
321 | QToolTip::add(mAlarmProgramButton, dispStr); | 320 | QToolTip::add(mAlarmProgramButton, dispStr); |
322 | mAlarmSoundButton->setOn(false); | 321 | mAlarmSoundButton->setOn(false); |
323 | mAlarmProgramButton->setOn(true); | 322 | mAlarmProgramButton->setOn(true); |
324 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 323 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
325 | } else { | 324 | } else { |
326 | mAlarmProgramButton->setOn(!oldState); | 325 | mAlarmProgramButton->setOn(!oldState); |
327 | mAlarmSoundButton->setOn(oldState); | 326 | mAlarmSoundButton->setOn(oldState); |
328 | } | 327 | } |
329 | 328 | ||
330 | if (mAlarmProgramButton->isOn()) | 329 | if (mAlarmProgramButton->isOn()) |
331 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 330 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
332 | if ( mAlarmSoundButton->isOn()) | 331 | if ( mAlarmSoundButton->isOn()) |
333 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 332 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
334 | 333 | ||
335 | } | 334 | } |
336 | 335 | ||
337 | 336 | ||
338 | QString KOEditorGeneral::getFittingPath( const QString s ) | 337 | QString KOEditorGeneral::getFittingPath( const QString s ) |
339 | { | 338 | { |
340 | int maxlen = 50; | 339 | int maxlen = 50; |
341 | if ( QApplication::desktop()->width() < 640 ) { | 340 | if ( QApplication::desktop()->width() < 640 ) { |
342 | if ( QApplication::desktop()->width() < 320 ) | 341 | if ( QApplication::desktop()->width() < 320 ) |
343 | maxlen = 22; | 342 | maxlen = 22; |
344 | else | 343 | else |
345 | maxlen = 35; | 344 | maxlen = 35; |
346 | } | 345 | } |
347 | if ( s.length() > maxlen ) { | 346 | if ( s.length() > maxlen ) { |
348 | return "..."+s.right(maxlen -3); | 347 | return "..."+s.right(maxlen -3); |
349 | } | 348 | } |
350 | return s; | 349 | return s; |
351 | } | 350 | } |
352 | 351 | ||
353 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 352 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
354 | { | 353 | { |
355 | if ( enable ) { | 354 | if ( enable ) { |
356 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 355 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
357 | mAlarmSoundButton->setOn( true ); | 356 | mAlarmSoundButton->setOn( true ); |
358 | if ( mAlarmSound.isEmpty() ) | 357 | if ( mAlarmSound.isEmpty() ) |
359 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 358 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
360 | else { | 359 | else { |
361 | if ( ! QFile::exists( mAlarmSound ) ) | 360 | if ( ! QFile::exists( mAlarmSound ) ) |
362 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 361 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
363 | } | 362 | } |
364 | } | 363 | } |
365 | } | 364 | } |
366 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); | 365 | ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); |
367 | mAlarmTimeEdit->setEnabled(enable); | 366 | mAlarmTimeEdit->setEnabled(enable); |
368 | mAlarmSoundButton->setEnabled(enable); | 367 | mAlarmSoundButton->setEnabled(enable); |
369 | mAlarmProgramButton->setEnabled(enable); | 368 | mAlarmProgramButton->setEnabled(enable); |
370 | mAlarmIncrCombo->setEnabled(enable); | 369 | mAlarmIncrCombo->setEnabled(enable); |
371 | } | 370 | } |
372 | 371 | ||
373 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 372 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
374 | { | 373 | { |
375 | enableAlarmEdit( !disable ); | 374 | enableAlarmEdit( !disable ); |
376 | } | 375 | } |
377 | 376 | ||
378 | void KOEditorGeneral::enableAlarm( bool enable ) | 377 | void KOEditorGeneral::enableAlarm( bool enable ) |
379 | { | 378 | { |
380 | enableAlarmEdit( enable ); | 379 | enableAlarmEdit( enable ); |
381 | } | 380 | } |
382 | 381 | ||
383 | void KOEditorGeneral::alarmDisable(bool disable) | 382 | void KOEditorGeneral::alarmDisable(bool disable) |
384 | { | 383 | { |
385 | if (!disable) { | 384 | if (!disable) { |
386 | //mAlarmBell->setEnabled(true); | 385 | //mAlarmBell->setEnabled(true); |
387 | mAlarmButton->setEnabled(true); | 386 | mAlarmButton->setEnabled(true); |
388 | } else { | 387 | } else { |
389 | //mAlarmBell->setEnabled(false); | 388 | //mAlarmBell->setEnabled(false); |
390 | mAlarmButton->setEnabled(false); | 389 | mAlarmButton->setEnabled(false); |
391 | mAlarmButton->setChecked(false); | 390 | mAlarmButton->setChecked(false); |
392 | mAlarmTimeEdit->setEnabled(false); | 391 | mAlarmTimeEdit->setEnabled(false); |
393 | mAlarmSoundButton->setEnabled(false); | 392 | mAlarmSoundButton->setEnabled(false); |
394 | mAlarmProgramButton->setEnabled(false); | 393 | mAlarmProgramButton->setEnabled(false); |
395 | mAlarmIncrCombo->setEnabled(false); | 394 | mAlarmIncrCombo->setEnabled(false); |
396 | } | 395 | } |
397 | } | 396 | } |
398 | 397 | ||
399 | void KOEditorGeneral::setCategories(const QString &str) | 398 | void KOEditorGeneral::setCategories(const QString &str) |
400 | { | 399 | { |
400 | QString tt = str; | ||
401 | QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); | ||
401 | mCategoriesLabel->setText(str); | 402 | mCategoriesLabel->setText(str); |
402 | } | 403 | } |
403 | 404 | ||
404 | void KOEditorGeneral::setDefaults(bool allDay) | 405 | void KOEditorGeneral::setDefaults(bool allDay) |
405 | { | 406 | { |
406 | #if 0 | 407 | #if 0 |
407 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 408 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
408 | #endif | 409 | #endif |
409 | 410 | ||
410 | mAlarmMessage = i18n("Edit new item"); | 411 | mAlarmMessage = i18n("Edit new item"); |
411 | enableAlarmEdit( !allDay ); | 412 | enableAlarmEdit( !allDay ); |
412 | 413 | ||
413 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 414 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
414 | int alarmTime; | 415 | int alarmTime; |
415 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 416 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
416 | int index = KOPrefs::instance()->mAlarmTime; | 417 | int index = KOPrefs::instance()->mAlarmTime; |
417 | if (index < 0 || index > 7) { | 418 | if (index < 0 || index > 7) { |
418 | alarmTime = 15; | 419 | alarmTime = 15; |
419 | } else { | 420 | } else { |
420 | alarmTime = a[index]; | 421 | alarmTime = a[index]; |
421 | } | 422 | } |
422 | mAlarmButton ->setChecked( false ); | 423 | mAlarmButton ->setChecked( false ); |
423 | mAlarmTimeEdit->setValue(alarmTime); | 424 | mAlarmTimeEdit->setValue(alarmTime); |
424 | mAlarmIncrCombo->setCurrentItem(0); | 425 | mAlarmIncrCombo->setCurrentItem(0); |
425 | enableAlarmEdit( false ); | 426 | enableAlarmEdit( false ); |
426 | //alarmDisable (false); | 427 | //alarmDisable (false); |
427 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 428 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
428 | mCancelBox->setChecked( false ); | 429 | mCancelBox->setChecked( false ); |
429 | mSummaryEdit->setEditText(""); | 430 | mSummaryEdit->setEditText(""); |
430 | mLocationEdit->setEditText(""); | 431 | mLocationEdit->setEditText(""); |
431 | mDescriptionEdit->setText(""); | 432 | mDescriptionEdit->setText(""); |
432 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 433 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
433 | setCategories(""); | 434 | setCategories(""); |
434 | } | 435 | } |
435 | void KOEditorGeneral::setSecrecy( int num ) | 436 | void KOEditorGeneral::setSecrecy( int num ) |
436 | { | 437 | { |
437 | mSecrecyCombo->setCurrentItem(num); | 438 | mSecrecyCombo->setCurrentItem(num); |
438 | } | 439 | } |
439 | void KOEditorGeneral::readIncidence(Incidence *event) | 440 | void KOEditorGeneral::readIncidence(Incidence *event) |
440 | { | 441 | { |
441 | 442 | ||
442 | mAlarmMessage = event->summary(); | 443 | mAlarmMessage = event->summary(); |
443 | if ( ! event->location().isEmpty() ) | 444 | if ( ! event->location().isEmpty() ) |
444 | mAlarmMessage += " ("+event->location()+")"; | 445 | mAlarmMessage += " ("+event->location()+")"; |
445 | mAlarmIncrCombo->setCurrentItem(0); | 446 | mAlarmIncrCombo->setCurrentItem(0); |
446 | mSummaryEdit->setEditText(event->summary()); | 447 | mSummaryEdit->setEditText(event->summary()); |
447 | mLocationEdit->setEditText(event->location()); | 448 | mLocationEdit->setEditText(event->location()); |
448 | mDescriptionEdit->setText(event->description()); | 449 | mDescriptionEdit->setText(event->description()); |
449 | 450 | ||
450 | #if 0 | 451 | #if 0 |
451 | // organizer information | 452 | // organizer information |
452 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 453 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
453 | #endif | 454 | #endif |
454 | 455 | ||
455 | enableAlarmEdit( event->isAlarmEnabled() ); | 456 | enableAlarmEdit( event->isAlarmEnabled() ); |
456 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 457 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
457 | if(!event->isAlarmEnabled()) { | 458 | if(!event->isAlarmEnabled()) { |
458 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 459 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
459 | int alarmTime; | 460 | int alarmTime; |
460 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 461 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
461 | int index = KOPrefs::instance()->mAlarmTime; | 462 | int index = KOPrefs::instance()->mAlarmTime; |
462 | if (index < 0 || index > 7) { | 463 | if (index < 0 || index > 7) { |
463 | alarmTime = 15; | 464 | alarmTime = 15; |
464 | } else { | 465 | } else { |
465 | alarmTime = a[index]; | 466 | alarmTime = a[index]; |
466 | } | 467 | } |
467 | mAlarmTimeEdit->setValue(alarmTime); | 468 | mAlarmTimeEdit->setValue(alarmTime); |
468 | } | 469 | } |
469 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 470 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
470 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 471 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
471 | mCancelBox->setChecked( event->cancelled() ); | 472 | mCancelBox->setChecked( event->cancelled() ); |
472 | mAlarmProgramButton->setOn(false); | 473 | mAlarmProgramButton->setOn(false); |
473 | mAlarmSoundButton->setOn(false); | 474 | mAlarmSoundButton->setOn(false); |
474 | 475 | ||
475 | // set up alarm stuff | 476 | // set up alarm stuff |
476 | QPtrList<Alarm> alarms = event->alarms(); | 477 | QPtrList<Alarm> alarms = event->alarms(); |
477 | Alarm* alarm; | 478 | Alarm* alarm; |
478 | mAlarmIncrCombo->setCurrentItem(0); | 479 | mAlarmIncrCombo->setCurrentItem(0); |
479 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 480 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
480 | int offset; | 481 | int offset; |
481 | if ( alarm->hasTime() ) { | 482 | if ( alarm->hasTime() ) { |
482 | QDateTime t = alarm->time(); | 483 | QDateTime t = alarm->time(); |
483 | offset = event->dtStart().secsTo( t ); | 484 | offset = event->dtStart().secsTo( t ); |
484 | } else { | 485 | } else { |
485 | offset = alarm->startOffset().asSeconds(); | 486 | offset = alarm->startOffset().asSeconds(); |
486 | } | 487 | } |
487 | if ( offset != 0 ) { | 488 | if ( offset != 0 ) { |
488 | offset = offset / -60; // make minutes | 489 | offset = offset / -60; // make minutes |
489 | if (offset % 60 == 0) { // divides evenly into hours? | 490 | if (offset % 60 == 0) { // divides evenly into hours? |
490 | offset = offset / 60; | 491 | offset = offset / 60; |
491 | mAlarmIncrCombo->setCurrentItem(1); | 492 | mAlarmIncrCombo->setCurrentItem(1); |
492 | if (offset % 24 == 0) { // divides evenly into days? | 493 | if (offset % 24 == 0) { // divides evenly into days? |
493 | offset = offset / 24; | 494 | offset = offset / 24; |
494 | mAlarmIncrCombo->setCurrentItem(2); | 495 | mAlarmIncrCombo->setCurrentItem(2); |
495 | } | 496 | } |
496 | } | 497 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 0c1ac7a..8f17e6e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -574,208 +574,213 @@ void KOListView::setCategories( bool removeOld ) | |||
574 | if ( removeOld ) { | 574 | if ( removeOld ) { |
575 | inc->setCategories( catList, setSub ); | 575 | inc->setCategories( catList, setSub ); |
576 | } else { | 576 | } else { |
577 | inc->addCategories( catList, setSub ); | 577 | inc->addCategories( catList, setSub ); |
578 | } | 578 | } |
579 | ListItemVisitor v(item, mStartDate ); | 579 | ListItemVisitor v(item, mStartDate ); |
580 | inc->accept(v); | 580 | inc->accept(v); |
581 | item = sel.next(); | 581 | item = sel.next(); |
582 | } | 582 | } |
583 | } | 583 | } |
584 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 584 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
585 | } | 585 | } |
586 | 586 | ||
587 | void KOListView::beamSelected() | 587 | void KOListView::beamSelected() |
588 | { | 588 | { |
589 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 589 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
590 | int icount = delSel.count(); | 590 | int icount = delSel.count(); |
591 | if ( icount ) { | 591 | if ( icount ) { |
592 | emit beamIncidenceList( delSel ); | 592 | emit beamIncidenceList( delSel ); |
593 | return; | 593 | return; |
594 | QString fn ; | 594 | QString fn ; |
595 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | 595 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; |
596 | QString mes; | 596 | QString mes; |
597 | bool createbup = true; | 597 | bool createbup = true; |
598 | if ( createbup ) { | 598 | if ( createbup ) { |
599 | QString description = "\n"; | 599 | QString description = "\n"; |
600 | CalendarLocal* cal = new CalendarLocal(); | 600 | CalendarLocal* cal = new CalendarLocal(); |
601 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 601 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
602 | Incidence *incidence = delSel.first(); | 602 | Incidence *incidence = delSel.first(); |
603 | while ( incidence ) { | 603 | while ( incidence ) { |
604 | Incidence *in = incidence->clone(); | 604 | Incidence *in = incidence->clone(); |
605 | description += in->summary() + "\n"; | 605 | description += in->summary() + "\n"; |
606 | cal->addIncidence( in ); | 606 | cal->addIncidence( in ); |
607 | incidence = delSel.next(); | 607 | incidence = delSel.next(); |
608 | } | 608 | } |
609 | FileStorage storage( cal, fn, new VCalFormat ); | 609 | FileStorage storage( cal, fn, new VCalFormat ); |
610 | storage.save(); | 610 | storage.save(); |
611 | delete cal; | 611 | delete cal; |
612 | mes = i18n("KO/Pi: Ready for beaming"); | 612 | mes = i18n("KO/Pi: Ready for beaming"); |
613 | topLevelWidget()->setCaption(mes); | 613 | topLevelWidget()->setCaption(mes); |
614 | 614 | ||
615 | #ifndef DESKTOP_VERSION | 615 | #ifndef DESKTOP_VERSION |
616 | Ir *ir = new Ir( this ); | 616 | Ir *ir = new Ir( this ); |
617 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 617 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
618 | ir->send( fn, description, "text/x-vCalendar" ); | 618 | ir->send( fn, description, "text/x-vCalendar" ); |
619 | #endif | 619 | #endif |
620 | } | 620 | } |
621 | } | 621 | } |
622 | } | 622 | } |
623 | void KOListView::beamDone( Ir *ir ) | 623 | void KOListView::beamDone( Ir *ir ) |
624 | { | 624 | { |
625 | #ifndef DESKTOP_VERSION | 625 | #ifndef DESKTOP_VERSION |
626 | delete ir; | 626 | delete ir; |
627 | #endif | 627 | #endif |
628 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | 628 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); |
629 | } | 629 | } |
630 | 630 | ||
631 | void KOListView::saveDescriptionToFile() | 631 | void KOListView::saveDescriptionToFile() |
632 | { | 632 | { |
633 | 633 | ||
634 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 634 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
635 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 635 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
636 | i18n("Continue"), i18n("Cancel"), 0, | 636 | i18n("Continue"), i18n("Cancel"), 0, |
637 | 0, 1 ); | 637 | 0, 1 ); |
638 | if ( result != 0 ) { | 638 | if ( result != 0 ) { |
639 | return; | 639 | return; |
640 | } | 640 | } |
641 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 641 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
642 | int icount = delSel.count(); | 642 | int icount = delSel.count(); |
643 | if ( icount ) { | 643 | if ( icount ) { |
644 | QString fn = KOPrefs::instance()->mLastSaveFile; | 644 | QString fn = KOPrefs::instance()->mLastSaveFile; |
645 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 645 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
646 | 646 | ||
647 | if ( fn == "" ) | 647 | if ( fn == "" ) |
648 | return; | 648 | return; |
649 | QFileInfo info; | 649 | QFileInfo info; |
650 | info.setFile( fn ); | 650 | info.setFile( fn ); |
651 | QString mes; | 651 | QString mes; |
652 | bool createbup = true; | 652 | bool createbup = true; |
653 | if ( info. exists() ) { | 653 | if ( info. exists() ) { |
654 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 654 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
656 | i18n("Overwrite!"), i18n("Cancel"), 0, | 656 | i18n("Overwrite!"), i18n("Cancel"), 0, |
657 | 0, 1 ); | 657 | 0, 1 ); |
658 | if ( result != 0 ) { | 658 | if ( result != 0 ) { |
659 | createbup = false; | 659 | createbup = false; |
660 | } | 660 | } |
661 | } | 661 | } |
662 | if ( createbup ) { | 662 | if ( createbup ) { |
663 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 663 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
664 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 664 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
665 | Incidence *incidence = delSel.first(); | 665 | Incidence *incidence = delSel.first(); |
666 | icount = 0; | 666 | icount = 0; |
667 | while ( incidence ) { | 667 | while ( incidence ) { |
668 | if ( incidence->typeID() == journalID ) { | 668 | if ( incidence->typeID() == journalID ) { |
669 | text += "\n************************************\n"; | 669 | text += "\n************************************\n"; |
670 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 670 | if ( !incidence->summary().isEmpty() ) |
671 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); | ||
672 | else | ||
673 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | ||
674 | if ( !incidence->location().isEmpty() ) | ||
675 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | ||
671 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 676 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
672 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 677 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
673 | ++icount; | 678 | ++icount; |
674 | 679 | ||
675 | } else { | 680 | } else { |
676 | if ( !incidence->description().isEmpty() ) { | 681 | if ( !incidence->description().isEmpty() ) { |
677 | text += "\n************************************\n"; | 682 | text += "\n************************************\n"; |
678 | if ( incidence->typeID() == todoID ) | 683 | if ( incidence->typeID() == todoID ) |
679 | text += i18n("To-Do: "); | 684 | text += i18n("To-Do: "); |
680 | text += incidence->summary(); | 685 | text += incidence->summary(); |
686 | if ( !incidence->location().isEmpty() ) | ||
687 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | ||
681 | if ( incidence->hasStartDate() ) | 688 | if ( incidence->hasStartDate() ) |
682 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 689 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
683 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 690 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
684 | if ( !incidence->location().isEmpty() ) | ||
685 | text += "\n" +i18n("Location: ") + incidence->location(); | ||
686 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 691 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
687 | ++icount; | 692 | ++icount; |
688 | 693 | ||
689 | } | 694 | } |
690 | } | 695 | } |
691 | incidence = delSel.next(); | 696 | incidence = delSel.next(); |
692 | } | 697 | } |
693 | QFile file( fn ); | 698 | QFile file( fn ); |
694 | if (!file.open( IO_WriteOnly ) ) { | 699 | if (!file.open( IO_WriteOnly ) ) { |
695 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 700 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
696 | return; | 701 | return; |
697 | } | 702 | } |
698 | QTextStream ts( &file ); | 703 | QTextStream ts( &file ); |
699 | ts << text; | 704 | ts << text; |
700 | file.close(); | 705 | file.close(); |
701 | //qDebug("%s ", text.latin1()); | 706 | //qDebug("%s ", text.latin1()); |
702 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 707 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
703 | KOPrefs::instance()->mLastSaveFile = fn; | 708 | KOPrefs::instance()->mLastSaveFile = fn; |
704 | topLevelWidget()->setCaption(mes); | 709 | topLevelWidget()->setCaption(mes); |
705 | } | 710 | } |
706 | } | 711 | } |
707 | } | 712 | } |
708 | void KOListView::saveToFileVCS() | 713 | void KOListView::saveToFileVCS() |
709 | { | 714 | { |
710 | writeToFile( false ); | 715 | writeToFile( false ); |
711 | } | 716 | } |
712 | void KOListView::saveToFile() | 717 | void KOListView::saveToFile() |
713 | { | 718 | { |
714 | writeToFile( true ); | 719 | writeToFile( true ); |
715 | } | 720 | } |
716 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 721 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
717 | { | 722 | { |
718 | QPtrList<Incidence> delSel ; | 723 | QPtrList<Incidence> delSel ; |
719 | bool addSubTodos = false; | 724 | bool addSubTodos = false; |
720 | bool askSubTodos = true; | 725 | bool askSubTodos = true; |
721 | QListViewItem *item = mListView->firstChild (); | 726 | QListViewItem *item = mListView->firstChild (); |
722 | while ( item ) { | 727 | while ( item ) { |
723 | if ( item->isSelected() ) { | 728 | if ( item->isSelected() ) { |
724 | Incidence* inc = ((KOListViewItem *)item)->data(); | 729 | Incidence* inc = ((KOListViewItem *)item)->data(); |
725 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 730 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
726 | if ( (inc->typeID() == todoID && includeTodos) || | 731 | if ( (inc->typeID() == todoID && includeTodos) || |
727 | (inc->typeID() == eventID && includeEvents) || | 732 | (inc->typeID() == eventID && includeEvents) || |
728 | (inc->typeID() == journalID && includeJournals) ) { | 733 | (inc->typeID() == journalID && includeJournals) ) { |
729 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 734 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
730 | if ( ((Todo*)inc)->hasDueDate() ) | 735 | if ( ((Todo*)inc)->hasDueDate() ) |
731 | delSel.append( inc ); | 736 | delSel.append( inc ); |
732 | } else | 737 | } else |
733 | delSel.append( inc ); | 738 | delSel.append( inc ); |
734 | 739 | ||
735 | } | 740 | } |
736 | } | 741 | } |
737 | if ( inc->typeID() == todoID ) { | 742 | if ( inc->typeID() == todoID ) { |
738 | Todo * todo = (Todo*) inc; | 743 | Todo * todo = (Todo*) inc; |
739 | if ( todo->relations().count() ) { | 744 | if ( todo->relations().count() ) { |
740 | if ( askSubTodos ) { | 745 | if ( askSubTodos ) { |
741 | int result = KMessageBox::warningYesNoCancel(this, | 746 | int result = KMessageBox::warningYesNoCancel(this, |
742 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), | 747 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
743 | i18n("Todo has subtodos"), | 748 | i18n("Todo has subtodos"), |
744 | i18n("Yes"), | 749 | i18n("Yes"), |
745 | i18n("No")); | 750 | i18n("No")); |
746 | if ( result == KMessageBox::Cancel ) { | 751 | if ( result == KMessageBox::Cancel ) { |
747 | delSel.clear(); | 752 | delSel.clear(); |
748 | return delSel; | 753 | return delSel; |
749 | } | 754 | } |
750 | if (result == KMessageBox::Yes) | 755 | if (result == KMessageBox::Yes) |
751 | addSubTodos = true; | 756 | addSubTodos = true; |
752 | askSubTodos = false; | 757 | askSubTodos = false; |
753 | } | 758 | } |
754 | if ( addSubTodos ) { | 759 | if ( addSubTodos ) { |
755 | inc->addRelationsToList( &delSel ); | 760 | inc->addRelationsToList( &delSel ); |
756 | } | 761 | } |
757 | } | 762 | } |
758 | } | 763 | } |
759 | } | 764 | } |
760 | item = item->nextSibling(); | 765 | item = item->nextSibling(); |
761 | } | 766 | } |
762 | return delSel; | 767 | return delSel; |
763 | } | 768 | } |
764 | 769 | ||
765 | void KOListView::writeToFile( bool iCal ) | 770 | void KOListView::writeToFile( bool iCal ) |
766 | { | 771 | { |
767 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 772 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
768 | if ( !iCal ) { | 773 | if ( !iCal ) { |
769 | bool journal = false; | 774 | bool journal = false; |
770 | Incidence *incidence = delSel.first(); | 775 | Incidence *incidence = delSel.first(); |
771 | while ( incidence ) { | 776 | while ( incidence ) { |
772 | if ( incidence->typeID() == journalID ) { | 777 | if ( incidence->typeID() == journalID ) { |
773 | journal = true; | 778 | journal = true; |
774 | break; | 779 | break; |
775 | } | 780 | } |
776 | incidence = delSel.next(); | 781 | incidence = delSel.next(); |
777 | } | 782 | } |
778 | if ( journal ) { | 783 | if ( journal ) { |
779 | int result = KMessageBox::warningContinueCancel(this, | 784 | int result = KMessageBox::warningContinueCancel(this, |
780 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 785 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
781 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 786 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |