summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 6a9a2f1..bd14fbf 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -616,48 +616,66 @@ void MainWindow::initActions()
616 616
617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
618 this ); 618 this );
619 mNewSubTodoAction->addTo( actionMenu ); 619 mNewSubTodoAction->addTo( actionMenu );
620 connect( mNewSubTodoAction, SIGNAL( activated() ), 620 connect( mNewSubTodoAction, SIGNAL( activated() ),
621 mView, SLOT( newSubTodo() ) ); 621 mView, SLOT( newSubTodo() ) );
622 622
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
626 mShowAction->addTo( actionMenu ); 626 mShowAction->addTo( actionMenu );
627 connect( mShowAction, SIGNAL( activated() ), 627 connect( mShowAction, SIGNAL( activated() ),
628 mView, SLOT( showIncidence() ) ); 628 mView, SLOT( showIncidence() ) );
629 629
630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
631 mEditAction->addTo( actionMenu ); 631 mEditAction->addTo( actionMenu );
632 connect( mEditAction, SIGNAL( activated() ), 632 connect( mEditAction, SIGNAL( activated() ),
633 mView, SLOT( editIncidence() ) ); 633 mView, SLOT( editIncidence() ) );
634 634
635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
636 mDeleteAction->addTo( actionMenu ); 636 mDeleteAction->addTo( actionMenu );
637 connect( mDeleteAction, SIGNAL( activated() ), 637 connect( mDeleteAction, SIGNAL( activated() ),
638 mView, SLOT( deleteIncidence() ) ); 638 mView, SLOT( deleteIncidence() ) );
639 639
640
641 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
642 mCloneAction->addTo( actionMenu );
643 connect( mCloneAction, SIGNAL( activated() ),
644 mView, SLOT( cloneIncidence() ) );
645 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
646 mMoveAction->addTo( actionMenu );
647 connect( mMoveAction, SIGNAL( activated() ),
648 mView, SLOT( moveIncidence() ) );
649 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
650 mBeamAction->addTo( actionMenu );
651 connect( mBeamAction, SIGNAL( activated() ),
652 mView, SLOT( beamIncidence() ) );
653 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
654 mCancelAction->addTo( actionMenu );
655 connect( mCancelAction, SIGNAL( activated() ),
656 mView, SLOT( toggleCancelIncidence() ) );
657
640 actionMenu->insertSeparator(); 658 actionMenu->insertSeparator();
641 659
642 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 660 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
643 this ); 661 this );
644 action->addTo( actionMenu ); 662 action->addTo( actionMenu );
645 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 663 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
646 664
647 icon = loadPixmap( pathString + "search" ); 665 icon = loadPixmap( pathString + "search" );
648 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 666 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
649 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 667 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
650 search_action->addTo( actionMenu ); 668 search_action->addTo( actionMenu );
651 connect( search_action, SIGNAL( activated() ), 669 connect( search_action, SIGNAL( activated() ),
652 mView->dialogManager(), SLOT( showSearchDialog() ) ); 670 mView->dialogManager(), SLOT( showSearchDialog() ) );
653 671
654 icon = loadPixmap( pathString + "today" ); 672 icon = loadPixmap( pathString + "today" );
655 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 673 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
656 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 674 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
657 today_action->addTo( actionMenu ); 675 today_action->addTo( actionMenu );
658 connect( today_action, SIGNAL( activated() ), 676 connect( today_action, SIGNAL( activated() ),
659 mView, SLOT( goToday() ) ); 677 mView, SLOT( goToday() ) );
660 678
661 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
662 actionMenu->insertSeparator(); 680 actionMenu->insertSeparator();
663 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 681 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
@@ -1165,49 +1183,49 @@ void MainWindow::exportToPhone( int mode )
1165 if ( mode == 2 ) 1183 if ( mode == 2 )
1166 ex2phone.setCaption(i18n("Export filtered calendar")); 1184 ex2phone.setCaption(i18n("Export filtered calendar"));
1167 1185
1168 if ( !ex2phone.exec() ) { 1186 if ( !ex2phone.exec() ) {
1169 return; 1187 return;
1170 } 1188 }
1171 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1189 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1172 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1190 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1173 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1191 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1174 1192
1175 int inFuture = 0; 1193 int inFuture = 0;
1176 if ( ex2phone.mWriteBackFuture->isChecked() ) 1194 if ( ex2phone.mWriteBackFuture->isChecked() )
1177 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1195 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1178 QPtrList<Incidence> delSel; 1196 QPtrList<Incidence> delSel;
1179 if ( mode == 1 ) 1197 if ( mode == 1 )
1180 delSel = mCalendar->rawIncidences(); 1198 delSel = mCalendar->rawIncidences();
1181 if ( mode == 2 ) 1199 if ( mode == 2 )
1182 delSel = mCalendar->incidences(); 1200 delSel = mCalendar->incidences();
1183 CalendarLocal* cal = new CalendarLocal(); 1201 CalendarLocal* cal = new CalendarLocal();
1184 cal->setLocalTime(); 1202 cal->setLocalTime();
1185 Incidence *incidence = delSel.first(); 1203 Incidence *incidence = delSel.first();
1186 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1204 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1187 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1205 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1188 while ( incidence ) { 1206 while ( incidence ) {
1189 if ( incidence->type() != "journal" ) { 1207 if ( incidence->type() != "Journal" ) {
1190 bool add = true; 1208 bool add = true;
1191 if ( inFuture ) { 1209 if ( inFuture ) {
1192 QDateTime dt; 1210 QDateTime dt;
1193 if ( incidence->type() == "Todo" ) { 1211 if ( incidence->type() == "Todo" ) {
1194 Todo * t = (Todo*)incidence; 1212 Todo * t = (Todo*)incidence;
1195 if ( t->hasDueDate() ) 1213 if ( t->hasDueDate() )
1196 dt = t->dtDue(); 1214 dt = t->dtDue();
1197 else 1215 else
1198 dt = cur.addSecs( 62 ); 1216 dt = cur.addSecs( 62 );
1199 } 1217 }
1200 else { 1218 else {
1201 bool ok; 1219 bool ok;
1202 dt = incidence->getNextOccurence( cur, &ok ); 1220 dt = incidence->getNextOccurence( cur, &ok );
1203 if ( !ok ) 1221 if ( !ok )
1204 dt = cur.addSecs( -62 ); 1222 dt = cur.addSecs( -62 );
1205 } 1223 }
1206 if ( dt < cur || dt > end ) { 1224 if ( dt < cur || dt > end ) {
1207 add = false; 1225 add = false;
1208 } 1226 }
1209 } 1227 }
1210 if ( add ) { 1228 if ( add ) {
1211 Incidence *in = incidence->clone(); 1229 Incidence *in = incidence->clone();
1212 cal->addIncidence( in ); 1230 cal->addIncidence( in );
1213 } 1231 }
@@ -1477,48 +1495,53 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1477 mEditAction->setText( i18n("Edit Event...") ); 1495 mEditAction->setText( i18n("Edit Event...") );
1478 mDeleteAction->setText( i18n("Delete Event...") ); 1496 mDeleteAction->setText( i18n("Delete Event...") );
1479 1497
1480 mNewSubTodoAction->setEnabled( false ); 1498 mNewSubTodoAction->setEnabled( false );
1481 } else if ( incidence->type() == "Todo" ) { 1499 } else if ( incidence->type() == "Todo" ) {
1482 mShowAction->setText( i18n("Show Todo...") ); 1500 mShowAction->setText( i18n("Show Todo...") );
1483 mEditAction->setText( i18n("Edit Todo...") ); 1501 mEditAction->setText( i18n("Edit Todo...") );
1484 mDeleteAction->setText( i18n("Delete Todo...") ); 1502 mDeleteAction->setText( i18n("Delete Todo...") );
1485 1503
1486 mNewSubTodoAction->setEnabled( true ); 1504 mNewSubTodoAction->setEnabled( true );
1487 } else { 1505 } else {
1488 mShowAction->setText( i18n("Show...") ); 1506 mShowAction->setText( i18n("Show...") );
1489 mShowAction->setText( i18n("Edit...") ); 1507 mShowAction->setText( i18n("Edit...") );
1490 mShowAction->setText( i18n("Delete...") ); 1508 mShowAction->setText( i18n("Delete...") );
1491 1509
1492 mNewSubTodoAction->setEnabled( false ); 1510 mNewSubTodoAction->setEnabled( false );
1493 } 1511 }
1494} 1512}
1495 1513
1496void MainWindow::enableIncidenceActions( bool enabled ) 1514void MainWindow::enableIncidenceActions( bool enabled )
1497{ 1515{
1498 mShowAction->setEnabled( enabled ); 1516 mShowAction->setEnabled( enabled );
1499 mEditAction->setEnabled( enabled ); 1517 mEditAction->setEnabled( enabled );
1500 mDeleteAction->setEnabled( enabled ); 1518 mDeleteAction->setEnabled( enabled );
1519
1520 mCloneAction->setEnabled( enabled );
1521 mMoveAction->setEnabled( enabled );
1522 mBeamAction->setEnabled( enabled );
1523 mCancelAction->setEnabled( enabled );
1501} 1524}
1502 1525
1503void MainWindow::importOL() 1526void MainWindow::importOL()
1504{ 1527{
1505#ifdef _WIN32_ 1528#ifdef _WIN32_
1506 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1529 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1507 id->exec(); 1530 id->exec();
1508 delete id; 1531 delete id;
1509 mView->updateView(); 1532 mView->updateView();
1510#endif 1533#endif
1511} 1534}
1512void MainWindow::importBday() 1535void MainWindow::importBday()
1513{ 1536{
1514 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1537 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1515 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1538 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1516 i18n("Import!"), i18n("Cancel"), 0, 1539 i18n("Import!"), i18n("Cancel"), 0,
1517 0, 1 ); 1540 0, 1 );
1518 if ( result == 0 ) { 1541 if ( result == 0 ) {
1519 mView->importBday(); 1542 mView->importBday();
1520 1543
1521 } 1544 }
1522 1545
1523 1546
1524} 1547}