author | zautrix <zautrix> | 2004-10-20 16:27:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 16:27:05 (UTC) |
commit | 46ea2933c9f67e77fb5c6cd93237efc755f28b62 (patch) (unidiff) | |
tree | 8025e9caceb2f62cd5b1d4b78b359545d38b39c5 /korganizer | |
parent | 5cf3c1bce58a6487af166e637e54571e98156fd0 (diff) | |
download | kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.zip kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.tar.gz kdepimpi-46ea2933c9f67e77fb5c6cd93237efc755f28b62.tar.bz2 |
made KDE sync perfect
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 63484d6..e3dad94 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1355,534 +1355,540 @@ void MainWindow::enableIncidenceActions( bool enabled ) | |||
1355 | mCloneAction->setEnabled( enabled ); | 1355 | mCloneAction->setEnabled( enabled ); |
1356 | mMoveAction->setEnabled( enabled ); | 1356 | mMoveAction->setEnabled( enabled ); |
1357 | mBeamAction->setEnabled( enabled ); | 1357 | mBeamAction->setEnabled( enabled ); |
1358 | mCancelAction->setEnabled( enabled ); | 1358 | mCancelAction->setEnabled( enabled ); |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | void MainWindow::importOL() | 1361 | void MainWindow::importOL() |
1362 | { | 1362 | { |
1363 | #ifdef _WIN32_ | 1363 | #ifdef _WIN32_ |
1364 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1364 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1365 | id->exec(); | 1365 | id->exec(); |
1366 | delete id; | 1366 | delete id; |
1367 | mView->updateView(); | 1367 | mView->updateView(); |
1368 | #endif | 1368 | #endif |
1369 | } | 1369 | } |
1370 | void MainWindow::importBday() | 1370 | void MainWindow::importBday() |
1371 | { | 1371 | { |
1372 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1372 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1373 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1373 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1374 | i18n("Import!"), i18n("Cancel"), 0, | 1374 | i18n("Import!"), i18n("Cancel"), 0, |
1375 | 0, 1 ); | 1375 | 0, 1 ); |
1376 | if ( result == 0 ) { | 1376 | if ( result == 0 ) { |
1377 | mView->importBday(); | 1377 | mView->importBday(); |
1378 | 1378 | ||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | 1381 | ||
1382 | } | 1382 | } |
1383 | void MainWindow::importQtopia() | 1383 | void MainWindow::importQtopia() |
1384 | { | 1384 | { |
1385 | #ifndef DESKTOP_VERSION | 1385 | #ifndef DESKTOP_VERSION |
1386 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1386 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1387 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1387 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1388 | i18n("Import!"), i18n("Cancel"), 0, | 1388 | i18n("Import!"), i18n("Cancel"), 0, |
1389 | 0, 1 ); | 1389 | 0, 1 ); |
1390 | if ( result == 0 ) { | 1390 | if ( result == 0 ) { |
1391 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1391 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1392 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1392 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1393 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1393 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1394 | mView->importQtopia( categories, datebook, todolist ); | 1394 | mView->importQtopia( categories, datebook, todolist ); |
1395 | } | 1395 | } |
1396 | #else | 1396 | #else |
1397 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1397 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1398 | i18n("Not supported \non desktop!\n"), | 1398 | i18n("Not supported \non desktop!\n"), |
1399 | i18n("Ok"), i18n("Cancel"), 0, | 1399 | i18n("Ok"), i18n("Cancel"), 0, |
1400 | 0, 1 ); | 1400 | 0, 1 ); |
1401 | 1401 | ||
1402 | #endif | 1402 | #endif |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | void MainWindow::saveOnClose() | 1405 | void MainWindow::saveOnClose() |
1406 | { | 1406 | { |
1407 | KOPrefs *p = KOPrefs::instance(); | 1407 | KOPrefs *p = KOPrefs::instance(); |
1408 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1408 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1409 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1409 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1410 | iconToolBar->y() > height()/2; | 1410 | iconToolBar->y() > height()/2; |
1411 | mView->writeSettings(); | 1411 | mView->writeSettings(); |
1412 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1412 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1413 | save(); | 1413 | save(); |
1414 | } | 1414 | } |
1415 | void MainWindow::slotModifiedChanged( bool changed ) | 1415 | void MainWindow::slotModifiedChanged( bool changed ) |
1416 | { | 1416 | { |
1417 | if ( mBlockAtStartup ) | 1417 | if ( mBlockAtStartup ) |
1418 | return; | 1418 | return; |
1419 | int msec; | 1419 | int msec; |
1420 | // we store the changes after 1 minute, | 1420 | // we store the changes after 1 minute, |
1421 | // and for safety reasons after 10 minutes again | 1421 | // and for safety reasons after 10 minutes again |
1422 | if ( !mSyncManager->blockSave() ) | 1422 | if ( !mSyncManager->blockSave() ) |
1423 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1423 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1424 | else | 1424 | else |
1425 | msec = 1000 * 600; | 1425 | msec = 1000 * 600; |
1426 | mSaveTimer.start( msec, true ); // 1 minute | 1426 | mSaveTimer.start( msec, true ); // 1 minute |
1427 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1427 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1428 | mCalendarModifiedFlag = true; | 1428 | mCalendarModifiedFlag = true; |
1429 | } | 1429 | } |
1430 | void MainWindow::save() | 1430 | void MainWindow::save() |
1431 | { | 1431 | { |
1432 | if ( mSyncManager->blockSave() ) | 1432 | if ( mSyncManager->blockSave() ) |
1433 | return; | 1433 | return; |
1434 | mSyncManager->setBlockSave(true); | 1434 | mSyncManager->setBlockSave(true); |
1435 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1435 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1436 | 1436 | ||
1437 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1437 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1438 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1438 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1439 | qDebug("KO: Start saving data to file!"); | 1439 | qDebug("KO: Start saving data to file!"); |
1440 | mView->saveCalendar( defaultFileName() ); | 1440 | mView->saveCalendar( defaultFileName() ); |
1441 | 1441 | ||
1442 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1442 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1443 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1443 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1444 | QString savemes; | 1444 | QString savemes; |
1445 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1445 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1446 | setCaption(savemes); | 1446 | setCaption(savemes); |
1447 | } else | 1447 | } else |
1448 | setCaption(i18n("Saving cancelled!")); | 1448 | setCaption(i18n("Saving cancelled!")); |
1449 | mCalendarModifiedFlag = false; | 1449 | mCalendarModifiedFlag = false; |
1450 | mSyncManager->setBlockSave( false ); | 1450 | mSyncManager->setBlockSave( false ); |
1451 | } | 1451 | } |
1452 | 1452 | ||
1453 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1453 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1454 | { | 1454 | { |
1455 | if ( !e->isAutoRepeat() ) { | 1455 | if ( !e->isAutoRepeat() ) { |
1456 | mFlagKeyPressed = false; | 1456 | mFlagKeyPressed = false; |
1457 | } | 1457 | } |
1458 | } | 1458 | } |
1459 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1459 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1460 | { | 1460 | { |
1461 | qApp->processEvents(); | 1461 | qApp->processEvents(); |
1462 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1462 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1463 | e->ignore(); | 1463 | e->ignore(); |
1464 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1464 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1465 | return; | 1465 | return; |
1466 | } | 1466 | } |
1467 | if (! e->isAutoRepeat() ) | 1467 | if (! e->isAutoRepeat() ) |
1468 | mFlagKeyPressed = true; | 1468 | mFlagKeyPressed = true; |
1469 | KOPrefs *p = KOPrefs::instance(); | 1469 | KOPrefs *p = KOPrefs::instance(); |
1470 | bool showSelectedDates = false; | 1470 | bool showSelectedDates = false; |
1471 | int size; | 1471 | int size; |
1472 | int pro = 0; | 1472 | int pro = 0; |
1473 | //qDebug("MainWindow::keyPressEvent "); | 1473 | //qDebug("MainWindow::keyPressEvent "); |
1474 | switch ( e->key() ) { | 1474 | switch ( e->key() ) { |
1475 | case Qt::Key_Right: | 1475 | case Qt::Key_Right: |
1476 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1476 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1477 | mView->goNextMonth(); | 1477 | mView->goNextMonth(); |
1478 | else | 1478 | else |
1479 | mView->goNext(); | 1479 | mView->goNext(); |
1480 | showSelectedDates = true; | 1480 | showSelectedDates = true; |
1481 | break; | 1481 | break; |
1482 | case Qt::Key_Left: | 1482 | case Qt::Key_Left: |
1483 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1483 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1484 | mView->goPreviousMonth(); | 1484 | mView->goPreviousMonth(); |
1485 | else | 1485 | else |
1486 | mView->goPrevious(); | 1486 | mView->goPrevious(); |
1487 | showSelectedDates = true; | 1487 | showSelectedDates = true; |
1488 | break; | 1488 | break; |
1489 | case Qt::Key_Down: | 1489 | case Qt::Key_Down: |
1490 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1490 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1491 | break; | 1491 | break; |
1492 | case Qt::Key_Up: | 1492 | case Qt::Key_Up: |
1493 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1493 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1494 | break; | 1494 | break; |
1495 | case Qt::Key_I: | 1495 | case Qt::Key_I: |
1496 | mView->showIncidence(); | 1496 | mView->showIncidence(); |
1497 | break; | 1497 | break; |
1498 | case Qt::Key_Delete: | 1498 | case Qt::Key_Delete: |
1499 | case Qt::Key_Backspace: | 1499 | case Qt::Key_Backspace: |
1500 | mView->deleteIncidence(); | 1500 | mView->deleteIncidence(); |
1501 | break; | 1501 | break; |
1502 | case Qt::Key_D: | 1502 | case Qt::Key_D: |
1503 | mView->viewManager()->showDayView(); | 1503 | mView->viewManager()->showDayView(); |
1504 | showSelectedDates = true; | 1504 | showSelectedDates = true; |
1505 | break; | 1505 | break; |
1506 | case Qt::Key_O: | 1506 | case Qt::Key_O: |
1507 | mView->toggleFilerEnabled( ); | 1507 | mView->toggleFilerEnabled( ); |
1508 | break; | 1508 | break; |
1509 | case Qt::Key_0: | 1509 | case Qt::Key_0: |
1510 | case Qt::Key_1: | 1510 | case Qt::Key_1: |
1511 | case Qt::Key_2: | 1511 | case Qt::Key_2: |
1512 | case Qt::Key_3: | 1512 | case Qt::Key_3: |
1513 | case Qt::Key_4: | 1513 | case Qt::Key_4: |
1514 | case Qt::Key_5: | 1514 | case Qt::Key_5: |
1515 | case Qt::Key_6: | 1515 | case Qt::Key_6: |
1516 | case Qt::Key_7: | 1516 | case Qt::Key_7: |
1517 | case Qt::Key_8: | 1517 | case Qt::Key_8: |
1518 | case Qt::Key_9: | 1518 | case Qt::Key_9: |
1519 | pro = e->key()-48; | 1519 | pro = e->key()-48; |
1520 | if ( pro == 0 ) | 1520 | if ( pro == 0 ) |
1521 | pro = 10; | 1521 | pro = 10; |
1522 | if ( e->state() == Qt::ControlButton) | 1522 | if ( e->state() == Qt::ControlButton) |
1523 | pro += 10; | 1523 | pro += 10; |
1524 | break; | 1524 | break; |
1525 | case Qt::Key_M: | 1525 | case Qt::Key_M: |
1526 | mView->viewManager()->showMonthView(); | 1526 | mView->viewManager()->showMonthView(); |
1527 | showSelectedDates = true; | 1527 | showSelectedDates = true; |
1528 | break; | 1528 | break; |
1529 | case Qt::Key_Insert: | 1529 | case Qt::Key_Insert: |
1530 | mView->newEvent(); | 1530 | mView->newEvent(); |
1531 | break; | 1531 | break; |
1532 | case Qt::Key_S : | 1532 | case Qt::Key_S : |
1533 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1533 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1534 | mView->newSubTodo(); | 1534 | mView->newSubTodo(); |
1535 | else | 1535 | else |
1536 | mView->dialogManager()->showSearchDialog(); | 1536 | mView->dialogManager()->showSearchDialog(); |
1537 | break; | 1537 | break; |
1538 | case Qt::Key_Y : | 1538 | case Qt::Key_Y : |
1539 | case Qt::Key_Z : | 1539 | case Qt::Key_Z : |
1540 | mView->viewManager()->showWorkWeekView(); | 1540 | mView->viewManager()->showWorkWeekView(); |
1541 | showSelectedDates = true; | 1541 | showSelectedDates = true; |
1542 | break; | 1542 | break; |
1543 | case Qt::Key_U : | 1543 | case Qt::Key_U : |
1544 | mView->viewManager()->showWeekView(); | 1544 | mView->viewManager()->showWeekView(); |
1545 | showSelectedDates = true; | 1545 | showSelectedDates = true; |
1546 | break; | 1546 | break; |
1547 | case Qt::Key_H : | 1547 | case Qt::Key_H : |
1548 | keyBindings(); | 1548 | keyBindings(); |
1549 | break; | 1549 | break; |
1550 | case Qt::Key_W: | 1550 | case Qt::Key_W: |
1551 | mView->viewManager()->showWhatsNextView(); | 1551 | mView->viewManager()->showWhatsNextView(); |
1552 | break; | 1552 | break; |
1553 | case Qt::Key_L: | 1553 | case Qt::Key_L: |
1554 | mView->viewManager()->showListView(); | 1554 | mView->viewManager()->showListView(); |
1555 | break; | 1555 | break; |
1556 | case Qt::Key_N: | 1556 | case Qt::Key_N: |
1557 | mView->viewManager()->showNextXView(); | 1557 | mView->viewManager()->showNextXView(); |
1558 | showSelectedDates = true; | 1558 | showSelectedDates = true; |
1559 | break; | 1559 | break; |
1560 | case Qt::Key_V: | 1560 | case Qt::Key_V: |
1561 | mView->viewManager()->showTodoView(); | 1561 | mView->viewManager()->showTodoView(); |
1562 | break; | 1562 | break; |
1563 | case Qt::Key_C: | 1563 | case Qt::Key_C: |
1564 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1564 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1565 | break; | 1565 | break; |
1566 | case Qt::Key_P: | 1566 | case Qt::Key_P: |
1567 | mView->showDatePicker( ); | 1567 | mView->showDatePicker( ); |
1568 | break; | 1568 | break; |
1569 | case Qt::Key_F: | 1569 | case Qt::Key_F: |
1570 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1570 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1571 | mView->editFilters(); | 1571 | mView->editFilters(); |
1572 | else | 1572 | else |
1573 | mView->toggleFilter(); | 1573 | mView->toggleFilter(); |
1574 | break; | 1574 | break; |
1575 | case Qt::Key_X: | 1575 | case Qt::Key_X: |
1576 | mView->toggleDateNavigatorWidget(); | 1576 | mView->toggleDateNavigatorWidget(); |
1577 | break; | 1577 | break; |
1578 | case Qt::Key_Space: | 1578 | case Qt::Key_Space: |
1579 | mView->toggleExpand(); | 1579 | mView->toggleExpand(); |
1580 | break; | 1580 | break; |
1581 | case Qt::Key_A: | 1581 | case Qt::Key_A: |
1582 | mView->toggleAllDaySize(); | 1582 | mView->toggleAllDaySize(); |
1583 | break; | 1583 | break; |
1584 | case Qt::Key_T: | 1584 | case Qt::Key_T: |
1585 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1585 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1586 | mView->newTodo(); | 1586 | mView->newTodo(); |
1587 | else { | 1587 | else { |
1588 | mView->goToday(); | 1588 | mView->goToday(); |
1589 | showSelectedDates = true; | 1589 | showSelectedDates = true; |
1590 | } | 1590 | } |
1591 | break; | 1591 | break; |
1592 | case Qt::Key_J: | 1592 | case Qt::Key_J: |
1593 | mView->viewManager()->showJournalView(); | 1593 | mView->viewManager()->showJournalView(); |
1594 | break; | 1594 | break; |
1595 | case Qt::Key_B: | 1595 | case Qt::Key_B: |
1596 | mView->editIncidenceDescription();; | 1596 | mView->editIncidenceDescription();; |
1597 | break; | 1597 | break; |
1598 | // case Qt::Key_Return: | 1598 | // case Qt::Key_Return: |
1599 | case Qt::Key_E: | 1599 | case Qt::Key_E: |
1600 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1600 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1601 | mView->newEvent(); | 1601 | mView->newEvent(); |
1602 | else | 1602 | else |
1603 | mView->editIncidence(); | 1603 | mView->editIncidence(); |
1604 | break; | 1604 | break; |
1605 | case Qt::Key_Plus: | 1605 | case Qt::Key_Plus: |
1606 | size = p->mHourSize +2; | 1606 | size = p->mHourSize +2; |
1607 | if ( size <= 18 ) | 1607 | if ( size <= 18 ) |
1608 | configureAgenda( size ); | 1608 | configureAgenda( size ); |
1609 | break; | 1609 | break; |
1610 | case Qt::Key_Minus: | 1610 | case Qt::Key_Minus: |
1611 | size = p->mHourSize - 2; | 1611 | size = p->mHourSize - 2; |
1612 | if ( size >= 4 ) | 1612 | if ( size >= 4 ) |
1613 | configureAgenda( size ); | 1613 | configureAgenda( size ); |
1614 | break; | 1614 | break; |
1615 | 1615 | ||
1616 | 1616 | ||
1617 | default: | 1617 | default: |
1618 | e->ignore(); | 1618 | e->ignore(); |
1619 | } | 1619 | } |
1620 | if ( pro > 0 ) { | 1620 | if ( pro > 0 ) { |
1621 | mView->selectFilter( pro-1 ); | 1621 | mView->selectFilter( pro-1 ); |
1622 | } | 1622 | } |
1623 | if ( showSelectedDates ) { | 1623 | if ( showSelectedDates ) { |
1624 | ;// setCaptionToDates(); | 1624 | ;// setCaptionToDates(); |
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | void MainWindow::fillFilterMenu() | 1629 | void MainWindow::fillFilterMenu() |
1630 | { | 1630 | { |
1631 | selectFilterMenu->clear(); | 1631 | selectFilterMenu->clear(); |
1632 | bool disable = false; | 1632 | bool disable = false; |
1633 | if ( mView->filterView()->filtersEnabled() ) { | 1633 | if ( mView->filterView()->filtersEnabled() ) { |
1634 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1634 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |
1635 | } | 1635 | } |
1636 | else { | 1636 | else { |
1637 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | 1637 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); |
1638 | disable = true; | 1638 | disable = true; |
1639 | } | 1639 | } |
1640 | selectFilterMenu->insertSeparator(); | 1640 | selectFilterMenu->insertSeparator(); |
1641 | QPtrList<CalFilter> fili = mView->filters(); | 1641 | QPtrList<CalFilter> fili = mView->filters(); |
1642 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1642 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1643 | CalFilter *filter = fili.first(); | 1643 | CalFilter *filter = fili.first(); |
1644 | int iii = 1; | 1644 | int iii = 1; |
1645 | while(filter) { | 1645 | while(filter) { |
1646 | selectFilterMenu->insertItem( filter->name(), iii ); | 1646 | selectFilterMenu->insertItem( filter->name(), iii ); |
1647 | if ( filter == curfilter) | 1647 | if ( filter == curfilter) |
1648 | selectFilterMenu->setItemChecked( iii, true ); | 1648 | selectFilterMenu->setItemChecked( iii, true ); |
1649 | if ( disable ) | 1649 | if ( disable ) |
1650 | selectFilterMenu->setItemEnabled( iii, false ); | 1650 | selectFilterMenu->setItemEnabled( iii, false ); |
1651 | filter = fili.next(); | 1651 | filter = fili.next(); |
1652 | ++iii; | 1652 | ++iii; |
1653 | } | 1653 | } |
1654 | } | 1654 | } |
1655 | void MainWindow::selectFilter( int fil ) | 1655 | void MainWindow::selectFilter( int fil ) |
1656 | { | 1656 | { |
1657 | if ( fil == 0 ) { | 1657 | if ( fil == 0 ) { |
1658 | mView->toggleFilerEnabled( ); | 1658 | mView->toggleFilerEnabled( ); |
1659 | } else { | 1659 | } else { |
1660 | mView->selectFilter( fil-1 ); | 1660 | mView->selectFilter( fil-1 ); |
1661 | } | 1661 | } |
1662 | } | 1662 | } |
1663 | void MainWindow::configureToolBar( int item ) | 1663 | void MainWindow::configureToolBar( int item ) |
1664 | { | 1664 | { |
1665 | 1665 | ||
1666 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1666 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1667 | KOPrefs *p = KOPrefs::instance(); | 1667 | KOPrefs *p = KOPrefs::instance(); |
1668 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1668 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1669 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1669 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1670 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1670 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1671 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1671 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1672 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1672 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1673 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1673 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1674 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1674 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1675 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1675 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1676 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1676 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1677 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1677 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1678 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1678 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1679 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1679 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1680 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1680 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1681 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1681 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1682 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1682 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1683 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1683 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1684 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1684 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1685 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1685 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1686 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1686 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1687 | // initActions(); | 1687 | // initActions(); |
1688 | } | 1688 | } |
1689 | 1689 | ||
1690 | void MainWindow::setCaptionToDates() | 1690 | void MainWindow::setCaptionToDates() |
1691 | { | 1691 | { |
1692 | QString selDates; | 1692 | QString selDates; |
1693 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1693 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1694 | if (mView->startDate() < mView->endDate() ) | 1694 | if (mView->startDate() < mView->endDate() ) |
1695 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1695 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1696 | setCaption( i18n("Dates: ") + selDates ); | 1696 | setCaption( i18n("Dates: ") + selDates ); |
1697 | 1697 | ||
1698 | } | 1698 | } |
1699 | // parameter item == 0: reinit | 1699 | // parameter item == 0: reinit |
1700 | void MainWindow::configureAgenda( int item ) | 1700 | void MainWindow::configureAgenda( int item ) |
1701 | { | 1701 | { |
1702 | 1702 | ||
1703 | KOPrefs *p = KOPrefs::instance(); | 1703 | KOPrefs *p = KOPrefs::instance(); |
1704 | 1704 | ||
1705 | int i; | 1705 | int i; |
1706 | if ( item == 1 ) { | 1706 | if ( item == 1 ) { |
1707 | mView->toggleAllDaySize(); | 1707 | mView->toggleAllDaySize(); |
1708 | return; | 1708 | return; |
1709 | } | 1709 | } |
1710 | // do not allow 4 for widgets higher than 480 | 1710 | // do not allow 4 for widgets higher than 480 |
1711 | // if ( QApplication::desktop()->height() > 480 ) { | 1711 | // if ( QApplication::desktop()->height() > 480 ) { |
1712 | // if ( item == 4 ) | 1712 | // if ( item == 4 ) |
1713 | // item = 6; | 1713 | // item = 6; |
1714 | // } | 1714 | // } |
1715 | for ( i = 4; i <= 18; i= i+2 ) | 1715 | for ( i = 4; i <= 18; i= i+2 ) |
1716 | configureAgendaMenu->setItemChecked( i, false ); | 1716 | configureAgendaMenu->setItemChecked( i, false ); |
1717 | configureAgendaMenu->setItemChecked( item, true ); | 1717 | configureAgendaMenu->setItemChecked( item, true ); |
1718 | if ( p->mHourSize == item ) | 1718 | if ( p->mHourSize == item ) |
1719 | return; | 1719 | return; |
1720 | p->mHourSize=item; | 1720 | p->mHourSize=item; |
1721 | mView->viewManager()->agendaView()->updateConfig(); | 1721 | mView->viewManager()->agendaView()->updateConfig(); |
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | void MainWindow::saveCalendar() | 1724 | void MainWindow::saveCalendar() |
1725 | { | 1725 | { |
1726 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1726 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1727 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1727 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1728 | 1728 | ||
1729 | if ( fn == "" ) | 1729 | if ( fn == "" ) |
1730 | return; | 1730 | return; |
1731 | QFileInfo info; | 1731 | QFileInfo info; |
1732 | info.setFile( fn ); | 1732 | info.setFile( fn ); |
1733 | QString mes; | 1733 | QString mes; |
1734 | bool createbup = true; | 1734 | bool createbup = true; |
1735 | if ( info. exists() ) { | 1735 | if ( info. exists() ) { |
1736 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1736 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1737 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1737 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1738 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1738 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1739 | 0, 1 ); | 1739 | 0, 1 ); |
1740 | if ( result != 0 ) { | 1740 | if ( result != 0 ) { |
1741 | createbup = false; | 1741 | createbup = false; |
1742 | } | 1742 | } |
1743 | } | 1743 | } |
1744 | if ( createbup ) { | 1744 | if ( createbup ) { |
1745 | mView->saveCalendar( fn ); | 1745 | mView->saveCalendar( fn ); |
1746 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1746 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1747 | KOPrefs::instance()->mLastSaveFile = fn; | 1747 | KOPrefs::instance()->mLastSaveFile = fn; |
1748 | setCaption(mes); | 1748 | setCaption(mes); |
1749 | } | 1749 | } |
1750 | } | 1750 | } |
1751 | void MainWindow::loadCalendar() | 1751 | void MainWindow::loadCalendar() |
1752 | { | 1752 | { |
1753 | 1753 | ||
1754 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1754 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1755 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1755 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1756 | 1756 | ||
1757 | if ( fn == "" ) | 1757 | if ( fn == "" ) |
1758 | return; | 1758 | return; |
1759 | QFileInfo info; | 1759 | QFileInfo info; |
1760 | info.setFile( fn ); | 1760 | info.setFile( fn ); |
1761 | QString mess; | 1761 | QString mess; |
1762 | bool loadbup = true; | 1762 | bool loadbup = true; |
1763 | if ( info. exists() ) { | 1763 | if ( info. exists() ) { |
1764 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1764 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1765 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1765 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1766 | mess, | 1766 | mess, |
1767 | i18n("Load!"), i18n("Cancel"), 0, | 1767 | i18n("Load!"), i18n("Cancel"), 0, |
1768 | 0, 1 ); | 1768 | 0, 1 ); |
1769 | if ( result != 0 ) { | 1769 | if ( result != 0 ) { |
1770 | loadbup = false; | 1770 | loadbup = false; |
1771 | } | 1771 | } |
1772 | } else { | 1772 | } else { |
1773 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1773 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1774 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1774 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1775 | 0, 1 ); | 1775 | 0, 1 ); |
1776 | 1776 | ||
1777 | return; | 1777 | return; |
1778 | } | 1778 | } |
1779 | if ( loadbup ) { | 1779 | if ( loadbup ) { |
1780 | mView->openCalendar( fn ); | 1780 | mView->openCalendar( fn ); |
1781 | KOPrefs::instance()->mLastLoadFile = fn; | 1781 | KOPrefs::instance()->mLastLoadFile = fn; |
1782 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1782 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1783 | setCaption(mess); | 1783 | setCaption(mess); |
1784 | } | 1784 | } |
1785 | 1785 | ||
1786 | } | 1786 | } |
1787 | void MainWindow::quickImportIcal() | 1787 | void MainWindow::quickImportIcal() |
1788 | { | 1788 | { |
1789 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1789 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1790 | } | 1790 | } |
1791 | void MainWindow::importFile( QString fn, bool quick ) | 1791 | void MainWindow::importFile( QString fn, bool quick ) |
1792 | { | 1792 | { |
1793 | QFileInfo info; | 1793 | QFileInfo info; |
1794 | info.setFile( fn ); | 1794 | info.setFile( fn ); |
1795 | QString mess; | 1795 | QString mess; |
1796 | bool loadbup = true; | 1796 | bool loadbup = true; |
1797 | if ( !info. exists() ) { | 1797 | if ( !info. exists() ) { |
1798 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1798 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1799 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1799 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1800 | mess ); | 1800 | mess ); |
1801 | return; | 1801 | return; |
1802 | } | 1802 | } |
1803 | int result = 0; | 1803 | int result = 0; |
1804 | if ( !quick ) { | 1804 | if ( !quick ) { |
1805 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1805 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1806 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1806 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1807 | mess, | 1807 | mess, |
1808 | "Import", "Cancel", 0, | 1808 | "Import", "Cancel", 0, |
1809 | 0, 1 ); | 1809 | 0, 1 ); |
1810 | } | 1810 | } |
1811 | if ( result == 0 ) { | 1811 | if ( result == 0 ) { |
1812 | if ( mView->openCalendar( fn, true )) { | 1812 | if ( mView->openCalendar( fn, true )) { |
1813 | KOPrefs::instance()->mLastImportFile = fn; | 1813 | KOPrefs::instance()->mLastImportFile = fn; |
1814 | setCaption(i18n("Imported file successfully")); | 1814 | setCaption(i18n("Imported file successfully")); |
1815 | } else { | 1815 | } else { |
1816 | setCaption(i18n("Error importing file")); | 1816 | setCaption(i18n("Error importing file")); |
1817 | } | 1817 | } |
1818 | } | 1818 | } |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | void MainWindow::importIcal() | 1821 | void MainWindow::importIcal() |
1822 | { | 1822 | { |
1823 | 1823 | ||
1824 | QString fn =KOPrefs::instance()->mLastImportFile; | 1824 | QString fn =KOPrefs::instance()->mLastImportFile; |
1825 | 1825 | ||
1826 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1826 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1827 | if ( fn == "" ) | 1827 | if ( fn == "" ) |
1828 | return; | 1828 | return; |
1829 | importFile( fn, true ); | 1829 | importFile( fn, true ); |
1830 | 1830 | ||
1831 | } | 1831 | } |
1832 | 1832 | ||
1833 | void MainWindow::exportVCalendar() | 1833 | void MainWindow::exportVCalendar() |
1834 | { | 1834 | { |
1835 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1835 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1836 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1836 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1837 | if ( fn == "" ) | 1837 | if ( fn == "" ) |
1838 | return; | 1838 | return; |
1839 | QFileInfo info; | 1839 | QFileInfo info; |
1840 | info.setFile( fn ); | 1840 | info.setFile( fn ); |
1841 | QString mes; | 1841 | QString mes; |
1842 | bool createbup = true; | 1842 | bool createbup = true; |
1843 | if ( info. exists() ) { | 1843 | if ( info. exists() ) { |
1844 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1844 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1845 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1845 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1846 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1846 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1847 | 0, 1 ); | 1847 | 0, 1 ); |
1848 | if ( result != 0 ) { | 1848 | if ( result != 0 ) { |
1849 | createbup = false; | 1849 | createbup = false; |
1850 | } | 1850 | } |
1851 | } | 1851 | } |
1852 | if ( createbup ) { | 1852 | if ( createbup ) { |
1853 | if ( mView->exportVCalendar( fn ) ) { | 1853 | if ( mView->exportVCalendar( fn ) ) { |
1854 | KOPrefs::instance()->mLastVcalFile = fn; | 1854 | KOPrefs::instance()->mLastVcalFile = fn; |
1855 | if ( fn.length() > 20 ) | 1855 | if ( fn.length() > 20 ) |
1856 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1856 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1857 | else | 1857 | else |
1858 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1858 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1859 | setCaption(mes); | 1859 | setCaption(mes); |
1860 | } | 1860 | } |
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | void MainWindow::syncFileRequest() | 1865 | void MainWindow::syncFileRequest() |
1866 | { | 1866 | { |
1867 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | ||
1868 | mSyncManager->slotSyncMenu( 999 ); | ||
1869 | } | ||
1867 | save(); | 1870 | save(); |
1868 | } | 1871 | } |
1869 | void MainWindow::getFile( bool success ) | 1872 | void MainWindow::getFile( bool success ) |
1870 | { | 1873 | { |
1871 | if ( ! success ) { | 1874 | if ( ! success ) { |
1872 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1875 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1873 | return; | 1876 | return; |
1874 | } | 1877 | } |
1875 | mView->openCalendar( defaultFileName() ); | 1878 | mView->openCalendar( defaultFileName() ); |
1879 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | ||
1880 | mSyncManager->slotSyncMenu( 999 ); | ||
1881 | } | ||
1876 | setCaption( i18n("Pi-Sync successful!") ); | 1882 | setCaption( i18n("Pi-Sync successful!") ); |
1877 | } | 1883 | } |
1878 | 1884 | ||
1879 | void MainWindow::printSel( ) | 1885 | void MainWindow::printSel( ) |
1880 | { | 1886 | { |
1881 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1887 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
1882 | } | 1888 | } |
1883 | 1889 | ||
1884 | void MainWindow::printCal() | 1890 | void MainWindow::printCal() |
1885 | { | 1891 | { |
1886 | mView->print();//mCp->showDialog(); | 1892 | mView->print();//mCp->showDialog(); |
1887 | } | 1893 | } |
1888 | 1894 | ||