summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-25 00:08:08 (UTC)
committer zautrix <zautrix>2005-03-25 00:08:08 (UTC)
commit7c2e130ddd194f1c4b5365af6999a27c08232f4b (patch) (unidiff)
tree75665681327ee49d7650f4d840b5c8c772180fb4 /korganizer
parent5cf054b82738d65f9b0a34ccb51c993ee4a0189f (diff)
downloadkdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.zip
kdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.tar.gz
kdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp3
-rw-r--r--korganizer/koeditorgeneral.cpp15
-rw-r--r--korganizer/koeditorgeneral.h1
3 files changed, 15 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 5420822..2820ca2 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -455,192 +455,195 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
455 if (object != viewport()) { 455 if (object != viewport()) {
456 if (me->button() == RightButton || rightButtonPressed ) { 456 if (me->button() == RightButton || rightButtonPressed ) {
457 if ( blockMoving ) { 457 if ( blockMoving ) {
458 mClickedItem = (KOAgendaItem *)object; 458 mClickedItem = (KOAgendaItem *)object;
459 if (mActionItem ) { 459 if (mActionItem ) {
460 endItemAction(); 460 endItemAction();
461 } 461 }
462 leftMouseDown = false; // no more leftMouse computation 462 leftMouseDown = false; // no more leftMouse computation
463 if (mClickedItem) { 463 if (mClickedItem) {
464 selectItem(mClickedItem); 464 selectItem(mClickedItem);
465 emit showIncidencePopupSignal(mClickedItem->incidence()); 465 emit showIncidencePopupSignal(mClickedItem->incidence());
466 } 466 }
467 } 467 }
468 } else if (me->button() == LeftButton && leftMouseDown) { 468 } else if (me->button() == LeftButton && leftMouseDown) {
469 if (mActionItem) { 469 if (mActionItem) {
470 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 470 QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
471 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); 471 //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
472 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { 472 if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
473 mScrollUpTimer.stop(); 473 mScrollUpTimer.stop();
474 mScrollDownTimer.stop(); 474 mScrollDownTimer.stop();
475 mActionItem->resetMove(); 475 mActionItem->resetMove();
476 placeSubCells( mActionItem ); 476 placeSubCells( mActionItem );
477 // emit startDragSignal( mActionItem->incidence() ); 477 // emit startDragSignal( mActionItem->incidence() );
478 setCursor( arrowCursor ); 478 setCursor( arrowCursor );
479 mActionItem = 0; 479 mActionItem = 0;
480 mActionType = NOP; 480 mActionType = NOP;
481 mItemMoved = 0; 481 mItemMoved = 0;
482 leftMouseDown = false; 482 leftMouseDown = false;
483 return true; 483 return true;
484 } 484 }
485 endItemAction(); 485 endItemAction();
486 } 486 }
487 } 487 }
488 488
489 } else { // ---------- viewport() 489 } else { // ---------- viewport()
490 if (me->button() == RightButton || rightButtonPressed ) { //right click 490 if (me->button() == RightButton || rightButtonPressed ) { //right click
491 if ( blockMoving ) { // we did mot moved the mouse much - popup menu 491 if ( blockMoving ) { // we did mot moved the mouse much - popup menu
492 if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action 492 if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
493 endSelectAction( false ); // do not emit new event signal 493 endSelectAction( false ); // do not emit new event signal
494 leftMouseDown = false; // no more leftMouse computation 494 leftMouseDown = false; // no more leftMouse computation
495 } 495 }
496 int x,y; 496 int x,y;
497 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 497 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
498 int gx,gy; 498 int gx,gy;
499 contentsToGrid(x,y,gx,gy); 499 contentsToGrid(x,y,gx,gy);
500 mCurrentCellX = gx; 500 mCurrentCellX = gx;
501 mCurrentCellY = gy; 501 mCurrentCellY = gy;
502 mStartCellX = gx; 502 mStartCellX = gx;
503 mStartCellY = gy; 503 mStartCellY = gy;
504 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); 504 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
505 } 505 }
506 } 506 }
507 else if (me->button() == LeftButton && leftMouseDown ) { //left click 507 else if (me->button() == LeftButton && leftMouseDown ) { //left click
508 endSelectAction( true ); // emit new event signal 508 endSelectAction( true ); // emit new event signal
509 } 509 }
510 } 510 }
511 if (me->button() == LeftButton) 511 if (me->button() == LeftButton)
512 leftMouseDown = false; 512 leftMouseDown = false;
513 else if (me->button() == RightButton) 513 else if (me->button() == RightButton)
514 rightMouseDown = false; 514 rightMouseDown = false;
515 break; 515 break;
516 516
517 case QEvent::MouseMove: 517 case QEvent::MouseMove:
518 if ( !rightMouseDown && !leftMouseDown ) 518 if ( !rightMouseDown && !leftMouseDown )
519 return true; 519 return true;
520 if ( blockMoving ) { 520 if ( blockMoving ) {
521 int dX, dY; 521 int dX, dY;
522 dX = startX - viewportPos.x(); 522 dX = startX - viewportPos.x();
523 if ( dX < 0 ) 523 if ( dX < 0 )
524 dX = -dX; 524 dX = -dX;
525 dY = viewportPos.y() - startY; 525 dY = viewportPos.y() - startY;
526 if ( dY < 0 ) 526 if ( dY < 0 )
527 dY = -dY; 527 dY = -dY;
528 //qDebug("%d %d %d ", dX, dY , blockmoveDist ); 528 //qDebug("%d %d %d ", dX, dY , blockmoveDist );
529 if ( dX > blockmoveDist || dY > blockmoveDist ) { 529 if ( dX > blockmoveDist || dY > blockmoveDist ) {
530 blockMoving = false; 530 blockMoving = false;
531 } 531 }
532 } 532 }
533 if (object != viewport()) { 533 if (object != viewport()) {
534 KOAgendaItem *moveItem = (KOAgendaItem *)object; 534 KOAgendaItem *moveItem = (KOAgendaItem *)object;
535 if (!moveItem->incidence()->isReadOnly() ) { 535 if (!moveItem->incidence()->isReadOnly() ) {
536 if (!mActionItem) 536 if (!mActionItem)
537 setNoActionCursor(moveItem,viewportPos); 537 setNoActionCursor(moveItem,viewportPos);
538 else { 538 else {
539 if ( !blockMoving ) 539 if ( !blockMoving )
540 performItemAction(viewportPos); 540 performItemAction(viewportPos);
541 } 541 }
542 } 542 }
543 } else { // ---------- viewport() 543 } else { // ---------- viewport()
544 if ( mActionType == SELECT ) { 544 if ( mActionType == SELECT ) {
545 performSelectAction( viewportPos ); 545 performSelectAction( viewportPos );
546 } 546 }
547 } 547 }
548 break; 548 break;
549 549
550 case QEvent::MouseButtonDblClick: 550 case QEvent::MouseButtonDblClick:
551 blockMoving = false;
552 leftMouseDown = false;
553 rightMouseDown = false;
551 if (object == viewport()) { 554 if (object == viewport()) {
552 selectItem(0); 555 selectItem(0);
553 int x,y; 556 int x,y;
554 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 557 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
555 int gx,gy; 558 int gx,gy;
556 contentsToGrid(x,y,gx,gy); 559 contentsToGrid(x,y,gx,gy);
557 emit newEventSignal(gx,gy); 560 emit newEventSignal(gx,gy);
558 } else { 561 } else {
559 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; 562 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
560 selectItem(doubleClickedItem); 563 selectItem(doubleClickedItem);
561 if ( KOPrefs::instance()->mEditOnDoubleClick ) 564 if ( KOPrefs::instance()->mEditOnDoubleClick )
562 emit editIncidenceSignal(doubleClickedItem->incidence()); 565 emit editIncidenceSignal(doubleClickedItem->incidence());
563 else 566 else
564 emit showIncidenceSignal(doubleClickedItem->incidence()); 567 emit showIncidenceSignal(doubleClickedItem->incidence());
565 } 568 }
566 break; 569 break;
567 570
568 default: 571 default:
569 break; 572 break;
570 } 573 }
571 return true; 574 return true;
572} 575}
573 576
574void KOAgenda::newItem( int item ) 577void KOAgenda::newItem( int item )
575{ 578{
576 if ( item == 1 ) { //new event 579 if ( item == 1 ) { //new event
577 newEventSignal(mStartCellX ,mStartCellY ); 580 newEventSignal(mStartCellX ,mStartCellY );
578 } else 581 } else
579 if ( item == 2 ) { //new event 582 if ( item == 2 ) { //new event
580 newTodoSignal(mStartCellX ,mStartCellY ); 583 newTodoSignal(mStartCellX ,mStartCellY );
581 } else 584 } else
582 { 585 {
583 QDate day = mSelectedDates[mStartCellX]; 586 QDate day = mSelectedDates[mStartCellX];
584 emit showDateView( item, day ); 587 emit showDateView( item, day );
585 // 3Day view 588 // 3Day view
586 // 4Week view 589 // 4Week view
587 // 5Month view 590 // 5Month view
588 // 6Journal view 591 // 6Journal view
589 } 592 }
590} 593}
591void KOAgenda::startSelectAction(QPoint viewportPos) 594void KOAgenda::startSelectAction(QPoint viewportPos)
592{ 595{
593 //emit newStartSelectSignal(); 596 //emit newStartSelectSignal();
594 597
595 mActionType = SELECT; 598 mActionType = SELECT;
596 599
597 int x,y; 600 int x,y;
598 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 601 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
599 int gx,gy; 602 int gx,gy;
600 contentsToGrid(x,y,gx,gy); 603 contentsToGrid(x,y,gx,gy);
601 604
602 mStartCellX = gx; 605 mStartCellX = gx;
603 mStartCellY = gy; 606 mStartCellY = gy;
604 mCurrentCellX = gx; 607 mCurrentCellX = gx;
605 mCurrentCellY = gy; 608 mCurrentCellY = gy;
606 609
607 // Store coordinates of old selection 610 // Store coordinates of old selection
608 int selectionX = mSelectionCellX * mGridSpacingX; 611 int selectionX = mSelectionCellX * mGridSpacingX;
609 int selectionYTop = mSelectionYTop; 612 int selectionYTop = mSelectionYTop;
610 int selectionHeight = mSelectionHeight; 613 int selectionHeight = mSelectionHeight;
611 614
612 // Store new selection 615 // Store new selection
613 mSelectionCellX = gx; 616 mSelectionCellX = gx;
614 mSelectionYTop = gy * mGridSpacingY; 617 mSelectionYTop = gy * mGridSpacingY;
615 mSelectionHeight = mGridSpacingY; 618 mSelectionHeight = mGridSpacingY;
616 619
617 // Clear old selection 620 // Clear old selection
618 repaintContents( selectionX, selectionYTop, 621 repaintContents( selectionX, selectionYTop,
619 mGridSpacingX, selectionHeight,false ); 622 mGridSpacingX, selectionHeight,false );
620 623
621 // Paint new selection 624 // Paint new selection
622 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, 625 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
623 // mGridSpacingX, mSelectionHeight ); 626 // mGridSpacingX, mSelectionHeight );
624} 627}
625 628
626void KOAgenda::performSelectAction(QPoint viewportPos) 629void KOAgenda::performSelectAction(QPoint viewportPos)
627{ 630{
628 int x,y; 631 int x,y;
629 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 632 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
630 int gx,gy; 633 int gx,gy;
631 contentsToGrid(x,y,gx,gy); 634 contentsToGrid(x,y,gx,gy);
632 635
633 QPoint clipperPos = clipper()-> 636 QPoint clipperPos = clipper()->
634 mapFromGlobal(viewport()->mapToGlobal(viewportPos)); 637 mapFromGlobal(viewport()->mapToGlobal(viewportPos));
635 638
636 // Scroll if cursor was moved to upper or lower end of agenda. 639 // Scroll if cursor was moved to upper or lower end of agenda.
637 if (clipperPos.y() < mScrollBorderWidth) { 640 if (clipperPos.y() < mScrollBorderWidth) {
638 mScrollUpTimer.start(mScrollDelay); 641 mScrollUpTimer.start(mScrollDelay);
639 } else if (visibleHeight() - clipperPos.y() < 642 } else if (visibleHeight() - clipperPos.y() <
640 mScrollBorderWidth) { 643 mScrollBorderWidth) {
641 mScrollDownTimer.start(mScrollDelay); 644 mScrollDownTimer.start(mScrollDelay);
642 } else { 645 } else {
643 mScrollUpTimer.stop(); 646 mScrollUpTimer.stop();
644 mScrollDownTimer.stop(); 647 mScrollDownTimer.stop();
645 } 648 }
646 649
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 496f125..4ee5292 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -132,361 +132,368 @@ void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
132 132
133 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
137 137
138 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 141}
142 142
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 144{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 146
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
151 151
152 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
155} 155}
156 156
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 158{
159 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 168#endif
169 169
170} 170}
171 171
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 173{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 175
176 //mAlarmBell = new QLabel(parent); 176 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 177 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 178 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 179 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 180 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 181 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 183
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 185 alarmLayout->addWidget(mAlarmButton);
186 186
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 alarmLayout->addWidget(mAlarmTimeEdit); 188 alarmLayout->addWidget(mAlarmTimeEdit);
189 mAlarmIncrCombo = new QComboBox(false, parent); 189 mAlarmIncrCombo = new QComboBox(false, parent);
190 if ( QApplication::desktop()->width() < 320 ) { 190 if ( QApplication::desktop()->width() < 320 ) {
191 mAlarmIncrCombo->insertItem(i18n("min")); 191 mAlarmIncrCombo->insertItem(i18n("min"));
192 mAlarmIncrCombo->insertItem(i18n("hou")); 192 mAlarmIncrCombo->insertItem(i18n("hou"));
193 mAlarmIncrCombo->insertItem(i18n("day")); 193 mAlarmIncrCombo->insertItem(i18n("day"));
194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
196 } else { 196 } else {
197 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 197 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
198 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 198 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
199 mAlarmIncrCombo->insertItem(i18n("day(s)")); 199 mAlarmIncrCombo->insertItem(i18n("day(s)"));
200 } 200 }
201 201
202 // mAlarmIncrCombo->setMinimumHeight(20); 202 // mAlarmIncrCombo->setMinimumHeight(20);
203 alarmLayout->addWidget(mAlarmIncrCombo); 203 alarmLayout->addWidget(mAlarmIncrCombo);
204 mAlarmSoundButton = new QPushButton(parent); 204 mAlarmSoundButton = new QPushButton(parent);
205 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 205 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
206 mAlarmSoundButton->setToggleButton(true); 206 mAlarmSoundButton->setToggleButton(true);
207 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 207 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
209 alarmLayout->addWidget(mAlarmSoundButton); 209 alarmLayout->addWidget(mAlarmSoundButton);
210 210
211 mAlarmProgramButton = new QPushButton(parent); 211 mAlarmProgramButton = new QPushButton(parent);
212 mAlarmProgramButton->setPixmap(SmallIcon("run")); 212 mAlarmProgramButton->setPixmap(SmallIcon("run"));
213 mAlarmProgramButton->setToggleButton(true); 213 mAlarmProgramButton->setToggleButton(true);
214 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 214 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
216 alarmLayout->addWidget(mAlarmProgramButton); 216 alarmLayout->addWidget(mAlarmProgramButton);
217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
219 // if ( KOPrefs::instance()->mCompactDialogs ) { 219 // if ( KOPrefs::instance()->mCompactDialogs ) {
220 // mAlarmSoundButton->hide(); 220 // mAlarmSoundButton->hide();
221 // mAlarmProgramButton->hide(); 221 // mAlarmProgramButton->hide();
222 // } 222 // }
223} 223}
224 224
225void KOEditorGeneral::pickAlarmSound() 225void KOEditorGeneral::pickAlarmSound()
226{ 226{
227 227
228 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
228 //QString prefix = mAlarmSound; 229 //QString prefix = mAlarmSound;
229 if (!mAlarmSoundButton->isOn()) { 230 if (!mAlarmSoundButton->isOn()) {
230 //mAlarmSound = ""; 231 //mAlarmSound = "";
231 QToolTip::remove(mAlarmSoundButton); 232 QToolTip::remove(mAlarmSoundButton);
232 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 233 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
233 mAlarmProgramButton->setOn(true); 234 mAlarmProgramButton->setOn(true);
234 mAlarmSoundButton->setOn(false); 235 mAlarmSoundButton->setOn(false);
236 pickAlarmProgram();
235 } else { 237 } else {
236 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 238 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
237 i18n("*.wav|Wav Files"), 0)); 239 i18n("*.wav|Wav Files"), 0));
238 if (!fileName.isEmpty()) { 240 if (!fileName.isEmpty()) {
239 mAlarmSound = fileName; 241 mAlarmSound = fileName;
240 QToolTip::remove(mAlarmSoundButton); 242 QToolTip::remove(mAlarmSoundButton);
241 QString dispStr = i18n("Playing '%1'").arg(fileName); 243 QString dispStr = i18n("Playing '%1'").arg(fileName);
242 QToolTip::add(mAlarmSoundButton, dispStr); 244 QToolTip::add(mAlarmSoundButton, dispStr);
243 mAlarmProgramButton->setOn(false); 245 mAlarmProgramButton->setOn(false);
244 mAlarmSoundButton->setOn(true); 246 mAlarmSoundButton->setOn(true);
245 } else { 247 } else {
246 mAlarmProgramButton->setOn(true); 248 mAlarmProgramButton->setOn(true);
247 mAlarmSoundButton->setOn(false); 249 mAlarmSoundButton->setOn(false);
248 250
249 } 251 }
250 } 252 }
251 253
252 if (mAlarmProgramButton->isOn()) 254 if (mAlarmProgramButton->isOn())
253 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 255 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
254 if ( mAlarmSoundButton->isOn()) 256 if ( mAlarmSoundButton->isOn())
255 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio.Al.: ") + getFittingPath(mAlarmSound) ); 257 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
256} 258}
257 259
258void KOEditorGeneral::pickAlarmProgram() 260void KOEditorGeneral::pickAlarmProgram()
259{ 261{
260 if (!mAlarmProgramButton->isOn()) { 262 if (!mAlarmProgramButton->isOn()) {
261 //mAlarmProgram = ""; 263 //mAlarmProgram = "";
262 QToolTip::remove(mAlarmProgramButton); 264 QToolTip::remove(mAlarmProgramButton);
263 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 265 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
264 mAlarmProgramButton->setOn(false); 266 mAlarmProgramButton->setOn(false);
265 mAlarmSoundButton->setOn(true); 267 mAlarmSoundButton->setOn(true);
268 pickAlarmSound();
266 } else { 269 } else {
267 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); 270 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
268 if (!fileName.isEmpty()) { 271 if (!fileName.isEmpty()) {
269 mAlarmProgram = fileName; 272 mAlarmProgram = fileName;
270 QToolTip::remove(mAlarmProgramButton); 273 QToolTip::remove(mAlarmProgramButton);
271 QString dispStr = i18n("Running '%1'").arg(fileName); 274 QString dispStr = i18n("Running '%1'").arg(fileName);
272 QToolTip::add(mAlarmProgramButton, dispStr); 275 QToolTip::add(mAlarmProgramButton, dispStr);
273 mAlarmSoundButton->setOn(false); 276 mAlarmSoundButton->setOn(false);
274 mAlarmProgramButton->setOn(true); 277 mAlarmProgramButton->setOn(true);
275 } else { 278 } else {
276 mAlarmProgramButton->setOn(false); 279 mAlarmProgramButton->setOn(false);
277 mAlarmSoundButton->setOn(true); 280 mAlarmSoundButton->setOn(true);
278 } 281 }
279 } 282 }
280 if (mAlarmProgramButton->isOn()) 283 if (mAlarmProgramButton->isOn())
281 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 284 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
282 if ( mAlarmSoundButton->isOn()) 285 if ( mAlarmSoundButton->isOn())
283 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + getFittingPath(mAlarmSound) ); 286 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
284} 287}
285 288
286 289
287QString KOEditorGeneral::getFittingPath( const QString s ) 290QString KOEditorGeneral::getFittingPath( const QString s )
288{ 291{
289 int maxlen = 50; 292 int maxlen = 50;
290 if ( QApplication::desktop()->width() < 640 ) { 293 if ( QApplication::desktop()->width() < 640 ) {
291 if ( QApplication::desktop()->width() < 320 ) 294 if ( QApplication::desktop()->width() < 320 )
292 maxlen = 22; 295 maxlen = 22;
293 else 296 else
294 maxlen = 35; 297 maxlen = 35;
295 } 298 }
296 if ( s.length() > maxlen ) { 299 if ( s.length() > maxlen ) {
297 return "..."+s.right(maxlen -3); 300 return "..."+s.right(maxlen -3);
298 } 301 }
299 return s; 302 return s;
300} 303}
301 304
302void KOEditorGeneral::enableAlarmEdit(bool enable) 305void KOEditorGeneral::enableAlarmEdit(bool enable)
303{ 306{
304 if ( enable ) { 307 if ( enable ) {
305 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 308 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
306 mAlarmSoundButton->setOn( true ); 309 mAlarmSoundButton->setOn( true );
307 if ( mAlarmSound.isEmpty() ) 310 if ( mAlarmSound.isEmpty() )
308 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 311 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
309 else { 312 else {
310 if ( ! QFile::exists( mAlarmSound ) ) 313 if ( ! QFile::exists( mAlarmSound ) )
311 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 314 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
312 } 315 }
313 } 316 }
314 if (mAlarmProgramButton->isOn()) 317 if (mAlarmProgramButton->isOn())
315 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 318 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
316 if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 319 if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
317 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 320 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
318 } 321 }
319 else { 322 else {
320 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled for this item")); 323 ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
324 //((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Edit item: ") + mSummaryEdit->currentText());
325
321 326
322 } 327 }
323 mAlarmTimeEdit->setEnabled(enable); 328 mAlarmTimeEdit->setEnabled(enable);
324 mAlarmSoundButton->setEnabled(enable); 329 mAlarmSoundButton->setEnabled(enable);
325 mAlarmProgramButton->setEnabled(enable); 330 mAlarmProgramButton->setEnabled(enable);
326 mAlarmIncrCombo->setEnabled(enable); 331 mAlarmIncrCombo->setEnabled(enable);
327} 332}
328 333
329void KOEditorGeneral::disableAlarmEdit(bool disable) 334void KOEditorGeneral::disableAlarmEdit(bool disable)
330{ 335{
331 enableAlarmEdit( !disable ); 336 enableAlarmEdit( !disable );
332} 337}
333 338
334void KOEditorGeneral::enableAlarm( bool enable ) 339void KOEditorGeneral::enableAlarm( bool enable )
335{ 340{
336 enableAlarmEdit( enable ); 341 enableAlarmEdit( enable );
337} 342}
338 343
339void KOEditorGeneral::alarmDisable(bool disable) 344void KOEditorGeneral::alarmDisable(bool disable)
340{ 345{
341 if (!disable) { 346 if (!disable) {
342 //mAlarmBell->setEnabled(true); 347 //mAlarmBell->setEnabled(true);
343 mAlarmButton->setEnabled(true); 348 mAlarmButton->setEnabled(true);
344 } else { 349 } else {
345 //mAlarmBell->setEnabled(false); 350 //mAlarmBell->setEnabled(false);
346 mAlarmButton->setEnabled(false); 351 mAlarmButton->setEnabled(false);
347 mAlarmButton->setChecked(false); 352 mAlarmButton->setChecked(false);
348 mAlarmTimeEdit->setEnabled(false); 353 mAlarmTimeEdit->setEnabled(false);
349 mAlarmSoundButton->setEnabled(false); 354 mAlarmSoundButton->setEnabled(false);
350 mAlarmProgramButton->setEnabled(false); 355 mAlarmProgramButton->setEnabled(false);
351 mAlarmIncrCombo->setEnabled(false); 356 mAlarmIncrCombo->setEnabled(false);
352 } 357 }
353} 358}
354 359
355void KOEditorGeneral::setCategories(const QString &str) 360void KOEditorGeneral::setCategories(const QString &str)
356{ 361{
357 mCategoriesLabel->setText(str); 362 mCategoriesLabel->setText(str);
358} 363}
359 364
360void KOEditorGeneral::setDefaults(bool allDay) 365void KOEditorGeneral::setDefaults(bool allDay)
361{ 366{
362#if 0 367#if 0
363 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); 368 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName());
364#endif 369#endif
365 370
371 mAlarmMessage = i18n("Edit new item");
366 enableAlarmEdit( !allDay ); 372 enableAlarmEdit( !allDay );
367 373
368 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 374 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
369 int alarmTime; 375 int alarmTime;
370 int a[] = { 1,5,10,15,30,60,180, 1440 }; 376 int a[] = { 1,5,10,15,30,60,180, 1440 };
371 int index = KOPrefs::instance()->mAlarmTime; 377 int index = KOPrefs::instance()->mAlarmTime;
372 if (index < 0 || index > 7) { 378 if (index < 0 || index > 7) {
373 alarmTime = 15; 379 alarmTime = 15;
374 } else { 380 } else {
375 alarmTime = a[index]; 381 alarmTime = a[index];
376 } 382 }
377 mAlarmButton ->setChecked( false ); 383 mAlarmButton ->setChecked( false );
378 mAlarmTimeEdit->setValue(alarmTime); 384 mAlarmTimeEdit->setValue(alarmTime);
379 mAlarmIncrCombo->setCurrentItem(0); 385 mAlarmIncrCombo->setCurrentItem(0);
380 enableAlarmEdit( false ); 386 enableAlarmEdit( false );
381 //alarmDisable (false); 387 //alarmDisable (false);
382 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); 388 mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic);
383 mCancelBox->setChecked( false ); 389 mCancelBox->setChecked( false );
384 mSummaryEdit->setEditText(""); 390 mSummaryEdit->setEditText("");
385 mLocationEdit->setEditText(""); 391 mLocationEdit->setEditText("");
386 mDescriptionEdit->setText(""); 392 mDescriptionEdit->setText("");
387 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 393 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
388 setCategories(""); 394 setCategories("");
389} 395}
390void KOEditorGeneral::setSecrecy( int num ) 396void KOEditorGeneral::setSecrecy( int num )
391{ 397{
392 mSecrecyCombo->setCurrentItem(num); 398 mSecrecyCombo->setCurrentItem(num);
393} 399}
394void KOEditorGeneral::readIncidence(Incidence *event) 400void KOEditorGeneral::readIncidence(Incidence *event)
395{ 401{
396 402
403 mAlarmMessage = i18n("Edit") +" "+event->summary();
397 mAlarmIncrCombo->setCurrentItem(0); 404 mAlarmIncrCombo->setCurrentItem(0);
398 mSummaryEdit->setEditText(event->summary()); 405 mSummaryEdit->setEditText(event->summary());
399 mLocationEdit->setEditText(event->location()); 406 mLocationEdit->setEditText(event->location());
400 mDescriptionEdit->setText(event->description()); 407 mDescriptionEdit->setText(event->description());
401 408
402#if 0 409#if 0
403 // organizer information 410 // organizer information
404 mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); 411 mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
405#endif 412#endif
406 413
407 enableAlarmEdit( event->isAlarmEnabled() ); 414 enableAlarmEdit( event->isAlarmEnabled() );
408 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); 415 //qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
409 if(!event->isAlarmEnabled()) { 416 if(!event->isAlarmEnabled()) {
410 // TODO: Implement a KPrefsComboItem to solve this in a clean way. 417 // TODO: Implement a KPrefsComboItem to solve this in a clean way.
411 int alarmTime; 418 int alarmTime;
412 int a[] = { 1,5,10,15,30,60,180, 1440 }; 419 int a[] = { 1,5,10,15,30,60,180, 1440 };
413 int index = KOPrefs::instance()->mAlarmTime; 420 int index = KOPrefs::instance()->mAlarmTime;
414 if (index < 0 || index > 7) { 421 if (index < 0 || index > 7) {
415 alarmTime = 15; 422 alarmTime = 15;
416 } else { 423 } else {
417 alarmTime = a[index]; 424 alarmTime = a[index];
418 } 425 }
419 mAlarmTimeEdit->setValue(alarmTime); 426 mAlarmTimeEdit->setValue(alarmTime);
420 } 427 }
421 mAlarmButton->setChecked( event->isAlarmEnabled() ); 428 mAlarmButton->setChecked( event->isAlarmEnabled() );
422 mSecrecyCombo->setCurrentItem(event->secrecy()); 429 mSecrecyCombo->setCurrentItem(event->secrecy());
423 mCancelBox->setChecked( event->cancelled() ); 430 mCancelBox->setChecked( event->cancelled() );
424 mAlarmProgramButton->setOn(false); 431 mAlarmProgramButton->setOn(false);
425 mAlarmSoundButton->setOn(false); 432 mAlarmSoundButton->setOn(false);
426 433
427 // set up alarm stuff 434 // set up alarm stuff
428 QPtrList<Alarm> alarms = event->alarms(); 435 QPtrList<Alarm> alarms = event->alarms();
429 Alarm* alarm; 436 Alarm* alarm;
430 mAlarmIncrCombo->setCurrentItem(0); 437 mAlarmIncrCombo->setCurrentItem(0);
431 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { 438 for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
432 int offset; 439 int offset;
433 if ( alarm->hasTime() ) { 440 if ( alarm->hasTime() ) {
434 QDateTime t = alarm->time(); 441 QDateTime t = alarm->time();
435 offset = event->dtStart().secsTo( t ); 442 offset = event->dtStart().secsTo( t );
436 } else { 443 } else {
437 offset = alarm->startOffset().asSeconds(); 444 offset = alarm->startOffset().asSeconds();
438 } 445 }
439 if ( offset != 0 ) { 446 if ( offset != 0 ) {
440 offset = offset / -60; // make minutes 447 offset = offset / -60; // make minutes
441 if (offset % 60 == 0) { // divides evenly into hours? 448 if (offset % 60 == 0) { // divides evenly into hours?
442 offset = offset / 60; 449 offset = offset / 60;
443 mAlarmIncrCombo->setCurrentItem(1); 450 mAlarmIncrCombo->setCurrentItem(1);
444 if (offset % 24 == 0) { // divides evenly into days? 451 if (offset % 24 == 0) { // divides evenly into days?
445 offset = offset / 24; 452 offset = offset / 24;
446 mAlarmIncrCombo->setCurrentItem(2); 453 mAlarmIncrCombo->setCurrentItem(2);
447 } 454 }
448 } 455 }
449 } 456 }
450 mAlarmTimeEdit->setValue( offset ); 457 mAlarmTimeEdit->setValue( offset );
451 if (alarm->type() == Alarm::Procedure) { 458 if (alarm->type() == Alarm::Procedure) {
452 459
453 mAlarmProgram = alarm->programFile(); 460 mAlarmProgram = alarm->programFile();
454 mAlarmProgramButton->setOn(true); 461 mAlarmProgramButton->setOn(true);
455 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram); 462 QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
456 QToolTip::add(mAlarmProgramButton, dispStr); 463 QToolTip::add(mAlarmProgramButton, dispStr);
457 } 464 }
458 else if (alarm->type() == Alarm::Audio) { 465 else if (alarm->type() == Alarm::Audio) {
459 mAlarmSound = alarm->audioFile(); 466 mAlarmSound = alarm->audioFile();
460 if ( ! QFile::exists( mAlarmSound ) ) 467 if ( ! QFile::exists( mAlarmSound ) )
461 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 468 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
462 mAlarmSoundButton->setOn(true); 469 mAlarmSoundButton->setOn(true);
463 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound); 470 QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
464 QToolTip::add(mAlarmSoundButton, dispStr); 471 QToolTip::add(mAlarmSoundButton, dispStr);
465 } 472 }
466 mAlarmButton->setChecked(alarm->enabled()); 473 mAlarmButton->setChecked(alarm->enabled());
467 enableAlarmEdit( alarm->enabled() ); 474 enableAlarmEdit( alarm->enabled() );
468 //qDebug("nableAlarmEdit( alarm->enabled() )********* "); 475 //qDebug("nableAlarmEdit( alarm->enabled() )********* ");
469 // TODO: Deal with multiple alarms 476 // TODO: Deal with multiple alarms
470 break; // For now, stop after the first alarm 477 break; // For now, stop after the first alarm
471 } 478 }
472 479
473 setCategories(event->categoriesStr()); 480 setCategories(event->categoriesStr());
474} 481}
475 482
476void KOEditorGeneral::writeIncidence(Incidence *event) 483void KOEditorGeneral::writeIncidence(Incidence *event)
477{ 484{
478 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; 485 // kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
479 mLocationEdit->save(KOLocationBox::LOCATION); 486 mLocationEdit->save(KOLocationBox::LOCATION);
480 event->setSummary(mSummaryEdit->currentText()); 487 event->setSummary(mSummaryEdit->currentText());
481 event->setLocation(mLocationEdit->currentText()); 488 event->setLocation(mLocationEdit->currentText());
482 event->setDescription(mDescriptionEdit->text()); 489 event->setDescription(mDescriptionEdit->text());
483 event->setCategories(mCategoriesLabel->text()); 490 event->setCategories(mCategoriesLabel->text());
484 event->setSecrecy(mSecrecyCombo->currentItem()); 491 event->setSecrecy(mSecrecyCombo->currentItem());
485 event->setCancelled(mCancelBox->isChecked() );; 492 event->setCancelled(mCancelBox->isChecked() );;
486 // alarm stuff 493 // alarm stuff
487 if (mAlarmButton->isChecked()) { 494 if (mAlarmButton->isChecked()) {
488 if (event->alarms().count() == 0) 495 if (event->alarms().count() == 0)
489 event->newAlarm(); 496 event->newAlarm();
490 QPtrList<Alarm> alarms = event->alarms(); 497 QPtrList<Alarm> alarms = event->alarms();
491 Alarm *alarm; 498 Alarm *alarm;
492 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 499 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index de8edaf..f4728c7 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -15,99 +15,100 @@
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#ifndef KOEDITORGENERAL_H 23#ifndef KOEDITORGENERAL_H
24#define KOEDITORGENERAL_H 24#define KOEDITORGENERAL_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qgroupbox.h> 30#include <qgroupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qlistview.h> 33#include <qlistview.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37 37
38#include <ktextedit.h> 38#include <ktextedit.h>
39#include <krestrictedline.h> 39#include <krestrictedline.h>
40 40
41#include <libkcal/incidence.h> 41#include <libkcal/incidence.h>
42 42
43#include "ktimeedit.h" 43#include "ktimeedit.h"
44 44
45class KDateEdit; 45class KDateEdit;
46class KOLocationBox; 46class KOLocationBox;
47using namespace KCal; 47using namespace KCal;
48 48
49class KOEditorGeneral : public QObject 49class KOEditorGeneral : public QObject
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 public: 52 public:
53 KOEditorGeneral (QObject* parent=0,const char* name=0); 53 KOEditorGeneral (QObject* parent=0,const char* name=0);
54 virtual ~KOEditorGeneral(); 54 virtual ~KOEditorGeneral();
55 void setFocusOn( int i ); 55 void setFocusOn( int i );
56 void initHeader(QWidget *,QBoxLayout *); 56 void initHeader(QWidget *,QBoxLayout *);
57 void initDescription(QWidget *,QBoxLayout *); 57 void initDescription(QWidget *,QBoxLayout *);
58 void initSecrecy(QWidget *,QBoxLayout *); 58 void initSecrecy(QWidget *,QBoxLayout *);
59 void initCategories(QWidget *,QBoxLayout *); 59 void initCategories(QWidget *,QBoxLayout *);
60 void initAlarm(QWidget *,QBoxLayout *); 60 void initAlarm(QWidget *,QBoxLayout *);
61 61
62 /** Set widgets to default values */ 62 /** Set widgets to default values */
63 void setDefaults(bool allDay); 63 void setDefaults(bool allDay);
64 /** Read event object and setup widgets accordingly */ 64 /** Read event object and setup widgets accordingly */
65 void readIncidence(Incidence *); 65 void readIncidence(Incidence *);
66 /** Write event settings to event object */ 66 /** Write event settings to event object */
67 void writeIncidence(Incidence *); 67 void writeIncidence(Incidence *);
68 68
69 /** Check if the input is valid. */ 69 /** Check if the input is valid. */
70 bool validateInput() { return true; } 70 bool validateInput() { return true; }
71 71
72 void enableAlarm( bool enable ); 72 void enableAlarm( bool enable );
73 void setSecrecy( int num ); 73 void setSecrecy( int num );
74 public slots: 74 public slots:
75 void setCategories(const QString &); 75 void setCategories(const QString &);
76 void editCategories(); 76 void editCategories();
77 77
78 protected slots: 78 protected slots:
79 void enableAlarmEdit( bool enable ); 79 void enableAlarmEdit( bool enable );
80 void disableAlarmEdit( bool disable ); 80 void disableAlarmEdit( bool disable );
81 void alarmDisable( bool disable ); 81 void alarmDisable( bool disable );
82 void pickAlarmSound(); 82 void pickAlarmSound();
83 void pickAlarmProgram(); 83 void pickAlarmProgram();
84 84
85 signals: 85 signals:
86 void openCategoryDialog(); 86 void openCategoryDialog();
87 void allAccepted(); 87 void allAccepted();
88 88
89 protected: 89 protected:
90 //QLineEdit *mSummaryEdit; 90 //QLineEdit *mSummaryEdit;
91 //QLineEdit *mLocationEdit; 91 //QLineEdit *mLocationEdit;
92 KOLocationBox *mSummaryEdit; 92 KOLocationBox *mSummaryEdit;
93 KOLocationBox *mLocationEdit; 93 KOLocationBox *mLocationEdit;
94 QLabel *mAlarmBell; 94 QLabel *mAlarmBell;
95 QCheckBox *mAlarmButton; 95 QCheckBox *mAlarmButton;
96 QSpinBox *mAlarmTimeEdit; 96 QSpinBox *mAlarmTimeEdit;
97 QPushButton *mAlarmSoundButton; 97 QPushButton *mAlarmSoundButton;
98 QPushButton *mAlarmProgramButton; 98 QPushButton *mAlarmProgramButton;
99 QComboBox *mAlarmIncrCombo; 99 QComboBox *mAlarmIncrCombo;
100 KTextEdit *mDescriptionEdit; 100 KTextEdit *mDescriptionEdit;
101 QLabel *mOwnerLabel; 101 QLabel *mOwnerLabel;
102 QComboBox *mSecrecyCombo; 102 QComboBox *mSecrecyCombo;
103 QCheckBox *mCancelBox; 103 QCheckBox *mCancelBox;
104 QPushButton *mCategoriesButton; 104 QPushButton *mCategoriesButton;
105 QLabel *mCategoriesLabel; 105 QLabel *mCategoriesLabel;
106 106
107 private: 107 private:
108 QString getFittingPath( const QString ) ; 108 QString getFittingPath( const QString ) ;
109 QString mAlarmSound; 109 QString mAlarmSound;
110 QString mAlarmProgram; 110 QString mAlarmProgram;
111 QString mAlarmMessage;
111}; 112};
112 113
113#endif 114#endif