author | zautrix <zautrix> | 2004-08-06 15:59:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 15:59:59 (UTC) |
commit | 20918d06b98c5c2fef839d53b1b1d953da747cdf (patch) (unidiff) | |
tree | 761b98d9afd34e29886825728b14c11b5889fc0e | |
parent | f3307379ea27ad1394c9107c0129ecd3efd6bca6 (diff) | |
download | kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.zip kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.tar.gz kdepimpi-20918d06b98c5c2fef839d53b1b1d953da747cdf.tar.bz2 |
removed debug
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a93d8e5..c3c4c26 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1294,517 +1294,515 @@ void MainWindow::importQtopia() | |||
1294 | 1294 | ||
1295 | #endif | 1295 | #endif |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | void MainWindow::saveOnClose() | 1298 | void MainWindow::saveOnClose() |
1299 | { | 1299 | { |
1300 | KOPrefs *p = KOPrefs::instance(); | 1300 | KOPrefs *p = KOPrefs::instance(); |
1301 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1301 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1302 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1302 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1303 | iconToolBar->y() > height()/2; | 1303 | iconToolBar->y() > height()/2; |
1304 | mView->writeSettings(); | 1304 | mView->writeSettings(); |
1305 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1305 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1306 | save(); | 1306 | save(); |
1307 | } | 1307 | } |
1308 | void MainWindow::slotModifiedChanged( bool changed ) | 1308 | void MainWindow::slotModifiedChanged( bool changed ) |
1309 | { | 1309 | { |
1310 | if ( mBlockAtStartup ) | 1310 | if ( mBlockAtStartup ) |
1311 | return; | 1311 | return; |
1312 | int msec; | 1312 | int msec; |
1313 | // we store the changes after 1 minute, | 1313 | // we store the changes after 1 minute, |
1314 | // and for safety reasons after 10 minutes again | 1314 | // and for safety reasons after 10 minutes again |
1315 | if ( !mBlockSaveFlag ) | 1315 | if ( !mBlockSaveFlag ) |
1316 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1316 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1317 | else | 1317 | else |
1318 | msec = 1000 * 600; | 1318 | msec = 1000 * 600; |
1319 | mSaveTimer.start( msec, true ); // 1 minute | 1319 | mSaveTimer.start( msec, true ); // 1 minute |
1320 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1320 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1321 | mCalendarModifiedFlag = true; | 1321 | mCalendarModifiedFlag = true; |
1322 | } | 1322 | } |
1323 | #include <qfileinfo.h> | 1323 | #include <qfileinfo.h> |
1324 | void MainWindow::save() | 1324 | void MainWindow::save() |
1325 | { | 1325 | { |
1326 | if ( mBlockSaveFlag ) | 1326 | if ( mBlockSaveFlag ) |
1327 | return; | 1327 | return; |
1328 | bool store = mBlockSaveFlag; | 1328 | bool store = mBlockSaveFlag; |
1329 | mBlockSaveFlag = true; | 1329 | mBlockSaveFlag = true; |
1330 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1330 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1331 | 1331 | ||
1332 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1332 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1333 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1333 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1334 | qDebug("KO: Start saving data to file!"); | 1334 | qDebug("KO: Start saving data to file!"); |
1335 | mView->saveCalendar( defaultFileName() ); | 1335 | mView->saveCalendar( defaultFileName() ); |
1336 | 1336 | ||
1337 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1337 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1338 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1338 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); |
1339 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1339 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1340 | QString savemes; | 1340 | QString savemes; |
1341 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1341 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1342 | setCaption(savemes); | 1342 | setCaption(savemes); |
1343 | } else | 1343 | } else |
1344 | setCaption(i18n("Saving cancelled!")); | 1344 | setCaption(i18n("Saving cancelled!")); |
1345 | mCalendarModifiedFlag = false; | 1345 | mCalendarModifiedFlag = false; |
1346 | mBlockSaveFlag = store; | 1346 | mBlockSaveFlag = store; |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1349 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1350 | { | 1350 | { |
1351 | if ( !e->isAutoRepeat() ) { | 1351 | if ( !e->isAutoRepeat() ) { |
1352 | mFlagKeyPressed = false; | 1352 | mFlagKeyPressed = false; |
1353 | } | 1353 | } |
1354 | } | 1354 | } |
1355 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1355 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1356 | { | 1356 | { |
1357 | qApp->processEvents(); | 1357 | qApp->processEvents(); |
1358 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1358 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1359 | e->ignore(); | 1359 | e->ignore(); |
1360 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1360 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1361 | return; | 1361 | return; |
1362 | } | 1362 | } |
1363 | if (! e->isAutoRepeat() ) | 1363 | if (! e->isAutoRepeat() ) |
1364 | mFlagKeyPressed = true; | 1364 | mFlagKeyPressed = true; |
1365 | KOPrefs *p = KOPrefs::instance(); | 1365 | KOPrefs *p = KOPrefs::instance(); |
1366 | bool showSelectedDates = false; | 1366 | bool showSelectedDates = false; |
1367 | int size; | 1367 | int size; |
1368 | int pro = 0; | 1368 | int pro = 0; |
1369 | //qDebug("MainWindow::keyPressEvent "); | 1369 | //qDebug("MainWindow::keyPressEvent "); |
1370 | switch ( e->key() ) { | 1370 | switch ( e->key() ) { |
1371 | case Qt::Key_Right: | 1371 | case Qt::Key_Right: |
1372 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1372 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1373 | mView->goNextMonth(); | 1373 | mView->goNextMonth(); |
1374 | else | 1374 | else |
1375 | mView->goNext(); | 1375 | mView->goNext(); |
1376 | showSelectedDates = true; | 1376 | showSelectedDates = true; |
1377 | break; | 1377 | break; |
1378 | case Qt::Key_Left: | 1378 | case Qt::Key_Left: |
1379 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1379 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1380 | mView->goPreviousMonth(); | 1380 | mView->goPreviousMonth(); |
1381 | else | 1381 | else |
1382 | mView->goPrevious(); | 1382 | mView->goPrevious(); |
1383 | showSelectedDates = true; | 1383 | showSelectedDates = true; |
1384 | break; | 1384 | break; |
1385 | case Qt::Key_Down: | 1385 | case Qt::Key_Down: |
1386 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1386 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1387 | break; | 1387 | break; |
1388 | case Qt::Key_Up: | 1388 | case Qt::Key_Up: |
1389 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1389 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1390 | break; | 1390 | break; |
1391 | case Qt::Key_I: | 1391 | case Qt::Key_I: |
1392 | mView->showIncidence(); | 1392 | mView->showIncidence(); |
1393 | break; | 1393 | break; |
1394 | case Qt::Key_Delete: | 1394 | case Qt::Key_Delete: |
1395 | case Qt::Key_Backspace: | 1395 | case Qt::Key_Backspace: |
1396 | mView->deleteIncidence(); | 1396 | mView->deleteIncidence(); |
1397 | break; | 1397 | break; |
1398 | case Qt::Key_D: | 1398 | case Qt::Key_D: |
1399 | mView->viewManager()->showDayView(); | 1399 | mView->viewManager()->showDayView(); |
1400 | showSelectedDates = true; | 1400 | showSelectedDates = true; |
1401 | break; | 1401 | break; |
1402 | case Qt::Key_O: | 1402 | case Qt::Key_O: |
1403 | mView->toggleFilerEnabled( ); | 1403 | mView->toggleFilerEnabled( ); |
1404 | break; | 1404 | break; |
1405 | case Qt::Key_0: | 1405 | case Qt::Key_0: |
1406 | case Qt::Key_1: | 1406 | case Qt::Key_1: |
1407 | case Qt::Key_2: | 1407 | case Qt::Key_2: |
1408 | case Qt::Key_3: | 1408 | case Qt::Key_3: |
1409 | case Qt::Key_4: | 1409 | case Qt::Key_4: |
1410 | case Qt::Key_5: | 1410 | case Qt::Key_5: |
1411 | case Qt::Key_6: | 1411 | case Qt::Key_6: |
1412 | case Qt::Key_7: | 1412 | case Qt::Key_7: |
1413 | case Qt::Key_8: | 1413 | case Qt::Key_8: |
1414 | case Qt::Key_9: | 1414 | case Qt::Key_9: |
1415 | pro = e->key()-48; | 1415 | pro = e->key()-48; |
1416 | if ( pro == 0 ) | 1416 | if ( pro == 0 ) |
1417 | pro = 10; | 1417 | pro = 10; |
1418 | if ( e->state() == Qt::ControlButton) | 1418 | if ( e->state() == Qt::ControlButton) |
1419 | pro += 10; | 1419 | pro += 10; |
1420 | break; | 1420 | break; |
1421 | case Qt::Key_M: | 1421 | case Qt::Key_M: |
1422 | mView->viewManager()->showMonthView(); | 1422 | mView->viewManager()->showMonthView(); |
1423 | showSelectedDates = true; | 1423 | showSelectedDates = true; |
1424 | break; | 1424 | break; |
1425 | case Qt::Key_Insert: | 1425 | case Qt::Key_Insert: |
1426 | mView->newEvent(); | 1426 | mView->newEvent(); |
1427 | break; | 1427 | break; |
1428 | case Qt::Key_S : | 1428 | case Qt::Key_S : |
1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1430 | mView->newSubTodo(); | 1430 | mView->newSubTodo(); |
1431 | else | 1431 | else |
1432 | mView->dialogManager()->showSearchDialog(); | 1432 | mView->dialogManager()->showSearchDialog(); |
1433 | break; | 1433 | break; |
1434 | case Qt::Key_Y : | 1434 | case Qt::Key_Y : |
1435 | case Qt::Key_Z : | 1435 | case Qt::Key_Z : |
1436 | mView->viewManager()->showWorkWeekView(); | 1436 | mView->viewManager()->showWorkWeekView(); |
1437 | showSelectedDates = true; | 1437 | showSelectedDates = true; |
1438 | break; | 1438 | break; |
1439 | case Qt::Key_U : | 1439 | case Qt::Key_U : |
1440 | mView->viewManager()->showWeekView(); | 1440 | mView->viewManager()->showWeekView(); |
1441 | showSelectedDates = true; | 1441 | showSelectedDates = true; |
1442 | break; | 1442 | break; |
1443 | case Qt::Key_H : | 1443 | case Qt::Key_H : |
1444 | keyBindings(); | 1444 | keyBindings(); |
1445 | break; | 1445 | break; |
1446 | case Qt::Key_W: | 1446 | case Qt::Key_W: |
1447 | mView->viewManager()->showWhatsNextView(); | 1447 | mView->viewManager()->showWhatsNextView(); |
1448 | break; | 1448 | break; |
1449 | case Qt::Key_L: | 1449 | case Qt::Key_L: |
1450 | mView->viewManager()->showListView(); | 1450 | mView->viewManager()->showListView(); |
1451 | break; | 1451 | break; |
1452 | case Qt::Key_N: | 1452 | case Qt::Key_N: |
1453 | mView->viewManager()->showNextXView(); | 1453 | mView->viewManager()->showNextXView(); |
1454 | showSelectedDates = true; | 1454 | showSelectedDates = true; |
1455 | break; | 1455 | break; |
1456 | case Qt::Key_V: | 1456 | case Qt::Key_V: |
1457 | mView->viewManager()->showTodoView(); | 1457 | mView->viewManager()->showTodoView(); |
1458 | break; | 1458 | break; |
1459 | case Qt::Key_C: | 1459 | case Qt::Key_C: |
1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1461 | break; | 1461 | break; |
1462 | case Qt::Key_P: | 1462 | case Qt::Key_P: |
1463 | mView->showDatePicker( ); | 1463 | mView->showDatePicker( ); |
1464 | break; | 1464 | break; |
1465 | case Qt::Key_F: | 1465 | case Qt::Key_F: |
1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1467 | mView->editFilters(); | 1467 | mView->editFilters(); |
1468 | else | 1468 | else |
1469 | mView->toggleFilter(); | 1469 | mView->toggleFilter(); |
1470 | break; | 1470 | break; |
1471 | case Qt::Key_X: | 1471 | case Qt::Key_X: |
1472 | mView->toggleDateNavigatorWidget(); | 1472 | mView->toggleDateNavigatorWidget(); |
1473 | break; | 1473 | break; |
1474 | case Qt::Key_Space: | 1474 | case Qt::Key_Space: |
1475 | mView->toggleExpand(); | 1475 | mView->toggleExpand(); |
1476 | break; | 1476 | break; |
1477 | case Qt::Key_A: | 1477 | case Qt::Key_A: |
1478 | mView->toggleAllDaySize(); | 1478 | mView->toggleAllDaySize(); |
1479 | break; | 1479 | break; |
1480 | case Qt::Key_T: | 1480 | case Qt::Key_T: |
1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1482 | mView->newTodo(); | 1482 | mView->newTodo(); |
1483 | else { | 1483 | else { |
1484 | mView->goToday(); | 1484 | mView->goToday(); |
1485 | showSelectedDates = true; | 1485 | showSelectedDates = true; |
1486 | } | 1486 | } |
1487 | break; | 1487 | break; |
1488 | case Qt::Key_J: | 1488 | case Qt::Key_J: |
1489 | mView->viewManager()->showJournalView(); | 1489 | mView->viewManager()->showJournalView(); |
1490 | break; | 1490 | break; |
1491 | case Qt::Key_B: | 1491 | case Qt::Key_B: |
1492 | mView->editIncidenceDescription();; | 1492 | mView->editIncidenceDescription();; |
1493 | break; | 1493 | break; |
1494 | // case Qt::Key_Return: | 1494 | // case Qt::Key_Return: |
1495 | case Qt::Key_E: | 1495 | case Qt::Key_E: |
1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1497 | mView->newEvent(); | 1497 | mView->newEvent(); |
1498 | else | 1498 | else |
1499 | mView->editIncidence(); | 1499 | mView->editIncidence(); |
1500 | break; | 1500 | break; |
1501 | case Qt::Key_Plus: | 1501 | case Qt::Key_Plus: |
1502 | size = p->mHourSize +2; | 1502 | size = p->mHourSize +2; |
1503 | if ( size <= 18 ) | 1503 | if ( size <= 18 ) |
1504 | configureAgenda( size ); | 1504 | configureAgenda( size ); |
1505 | break; | 1505 | break; |
1506 | case Qt::Key_Minus: | 1506 | case Qt::Key_Minus: |
1507 | size = p->mHourSize - 2; | 1507 | size = p->mHourSize - 2; |
1508 | if ( size >= 4 ) | 1508 | if ( size >= 4 ) |
1509 | configureAgenda( size ); | 1509 | configureAgenda( size ); |
1510 | break; | 1510 | break; |
1511 | 1511 | ||
1512 | 1512 | ||
1513 | default: | 1513 | default: |
1514 | e->ignore(); | 1514 | e->ignore(); |
1515 | } | 1515 | } |
1516 | if ( pro > 0 ) { | 1516 | if ( pro > 0 ) { |
1517 | mView->selectFilter( pro-1 ); | 1517 | mView->selectFilter( pro-1 ); |
1518 | } | 1518 | } |
1519 | if ( showSelectedDates ) { | 1519 | if ( showSelectedDates ) { |
1520 | ;// setCaptionToDates(); | 1520 | ;// setCaptionToDates(); |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | void MainWindow::fillFilterMenu() | 1525 | void MainWindow::fillFilterMenu() |
1526 | { | 1526 | { |
1527 | selectFilterMenu->clear(); | 1527 | selectFilterMenu->clear(); |
1528 | bool disable = false; | 1528 | bool disable = false; |
1529 | if ( mView->filterView()->filtersEnabled() ) { | 1529 | if ( mView->filterView()->filtersEnabled() ) { |
1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |
1531 | } | 1531 | } |
1532 | else { | 1532 | else { |
1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | 1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); |
1534 | disable = true; | 1534 | disable = true; |
1535 | } | 1535 | } |
1536 | selectFilterMenu->insertSeparator(); | 1536 | selectFilterMenu->insertSeparator(); |
1537 | QPtrList<CalFilter> fili = mView->filters(); | 1537 | QPtrList<CalFilter> fili = mView->filters(); |
1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1539 | CalFilter *filter = fili.first(); | 1539 | CalFilter *filter = fili.first(); |
1540 | int iii = 1; | 1540 | int iii = 1; |
1541 | while(filter) { | 1541 | while(filter) { |
1542 | selectFilterMenu->insertItem( filter->name(), iii ); | 1542 | selectFilterMenu->insertItem( filter->name(), iii ); |
1543 | if ( filter == curfilter) | 1543 | if ( filter == curfilter) |
1544 | selectFilterMenu->setItemChecked( iii, true ); | 1544 | selectFilterMenu->setItemChecked( iii, true ); |
1545 | if ( disable ) | 1545 | if ( disable ) |
1546 | selectFilterMenu->setItemEnabled( iii, false ); | 1546 | selectFilterMenu->setItemEnabled( iii, false ); |
1547 | filter = fili.next(); | 1547 | filter = fili.next(); |
1548 | ++iii; | 1548 | ++iii; |
1549 | } | 1549 | } |
1550 | qDebug("rettich "); | ||
1551 | } | 1550 | } |
1552 | void MainWindow::selectFilter( int fil ) | 1551 | void MainWindow::selectFilter( int fil ) |
1553 | { | 1552 | { |
1554 | qDebug("selectFilter %d ", fil); | ||
1555 | if ( fil == 0 ) { | 1553 | if ( fil == 0 ) { |
1556 | mView->toggleFilerEnabled( ); | 1554 | mView->toggleFilerEnabled( ); |
1557 | } else { | 1555 | } else { |
1558 | mView->selectFilter( fil-1 ); | 1556 | mView->selectFilter( fil-1 ); |
1559 | } | 1557 | } |
1560 | } | 1558 | } |
1561 | void MainWindow::configureToolBar( int item ) | 1559 | void MainWindow::configureToolBar( int item ) |
1562 | { | 1560 | { |
1563 | 1561 | ||
1564 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1562 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1565 | KOPrefs *p = KOPrefs::instance(); | 1563 | KOPrefs *p = KOPrefs::instance(); |
1566 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1564 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1567 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1565 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1568 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1566 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1569 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1567 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1570 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1568 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1571 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1569 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1572 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1570 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1573 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1571 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1574 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1572 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1575 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1573 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1576 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1574 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1577 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1575 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1578 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1576 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1579 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1577 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1580 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1578 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1581 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1579 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1582 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1580 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1583 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1581 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1584 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1582 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1585 | // initActions(); | 1583 | // initActions(); |
1586 | } | 1584 | } |
1587 | 1585 | ||
1588 | void MainWindow::setCaptionToDates() | 1586 | void MainWindow::setCaptionToDates() |
1589 | { | 1587 | { |
1590 | QString selDates; | 1588 | QString selDates; |
1591 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1589 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1592 | if (mView->startDate() < mView->endDate() ) | 1590 | if (mView->startDate() < mView->endDate() ) |
1593 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1591 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1594 | setCaption( i18n("Dates: ") + selDates ); | 1592 | setCaption( i18n("Dates: ") + selDates ); |
1595 | 1593 | ||
1596 | } | 1594 | } |
1597 | // parameter item == 0: reinit | 1595 | // parameter item == 0: reinit |
1598 | void MainWindow::configureAgenda( int item ) | 1596 | void MainWindow::configureAgenda( int item ) |
1599 | { | 1597 | { |
1600 | 1598 | ||
1601 | KOPrefs *p = KOPrefs::instance(); | 1599 | KOPrefs *p = KOPrefs::instance(); |
1602 | 1600 | ||
1603 | int i; | 1601 | int i; |
1604 | if ( item == 1 ) { | 1602 | if ( item == 1 ) { |
1605 | mView->toggleAllDaySize(); | 1603 | mView->toggleAllDaySize(); |
1606 | return; | 1604 | return; |
1607 | } | 1605 | } |
1608 | // do not allow 4 for widgets higher than 480 | 1606 | // do not allow 4 for widgets higher than 480 |
1609 | // if ( QApplication::desktop()->height() > 480 ) { | 1607 | // if ( QApplication::desktop()->height() > 480 ) { |
1610 | // if ( item == 4 ) | 1608 | // if ( item == 4 ) |
1611 | // item = 6; | 1609 | // item = 6; |
1612 | // } | 1610 | // } |
1613 | for ( i = 4; i <= 18; i= i+2 ) | 1611 | for ( i = 4; i <= 18; i= i+2 ) |
1614 | configureAgendaMenu->setItemChecked( i, false ); | 1612 | configureAgendaMenu->setItemChecked( i, false ); |
1615 | configureAgendaMenu->setItemChecked( item, true ); | 1613 | configureAgendaMenu->setItemChecked( item, true ); |
1616 | if ( p->mHourSize == item ) | 1614 | if ( p->mHourSize == item ) |
1617 | return; | 1615 | return; |
1618 | p->mHourSize=item; | 1616 | p->mHourSize=item; |
1619 | mView->viewManager()->agendaView()->updateConfig(); | 1617 | mView->viewManager()->agendaView()->updateConfig(); |
1620 | } | 1618 | } |
1621 | 1619 | ||
1622 | void MainWindow::saveCalendar() | 1620 | void MainWindow::saveCalendar() |
1623 | { | 1621 | { |
1624 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1622 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1623 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1626 | 1624 | ||
1627 | if ( fn == "" ) | 1625 | if ( fn == "" ) |
1628 | return; | 1626 | return; |
1629 | QFileInfo info; | 1627 | QFileInfo info; |
1630 | info.setFile( fn ); | 1628 | info.setFile( fn ); |
1631 | QString mes; | 1629 | QString mes; |
1632 | bool createbup = true; | 1630 | bool createbup = true; |
1633 | if ( info. exists() ) { | 1631 | if ( info. exists() ) { |
1634 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1632 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1633 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1636 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1634 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1637 | 0, 1 ); | 1635 | 0, 1 ); |
1638 | if ( result != 0 ) { | 1636 | if ( result != 0 ) { |
1639 | createbup = false; | 1637 | createbup = false; |
1640 | } | 1638 | } |
1641 | } | 1639 | } |
1642 | if ( createbup ) { | 1640 | if ( createbup ) { |
1643 | mView->saveCalendar( fn ); | 1641 | mView->saveCalendar( fn ); |
1644 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1642 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1645 | KOPrefs::instance()->mLastSaveFile = fn; | 1643 | KOPrefs::instance()->mLastSaveFile = fn; |
1646 | setCaption(mes); | 1644 | setCaption(mes); |
1647 | } | 1645 | } |
1648 | } | 1646 | } |
1649 | void MainWindow::loadCalendar() | 1647 | void MainWindow::loadCalendar() |
1650 | { | 1648 | { |
1651 | 1649 | ||
1652 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1650 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1653 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1651 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1654 | 1652 | ||
1655 | if ( fn == "" ) | 1653 | if ( fn == "" ) |
1656 | return; | 1654 | return; |
1657 | QFileInfo info; | 1655 | QFileInfo info; |
1658 | info.setFile( fn ); | 1656 | info.setFile( fn ); |
1659 | QString mess; | 1657 | QString mess; |
1660 | bool loadbup = true; | 1658 | bool loadbup = true; |
1661 | if ( info. exists() ) { | 1659 | if ( info. exists() ) { |
1662 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1660 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1663 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1661 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1664 | mess, | 1662 | mess, |
1665 | i18n("Load!"), i18n("Cancel"), 0, | 1663 | i18n("Load!"), i18n("Cancel"), 0, |
1666 | 0, 1 ); | 1664 | 0, 1 ); |
1667 | if ( result != 0 ) { | 1665 | if ( result != 0 ) { |
1668 | loadbup = false; | 1666 | loadbup = false; |
1669 | } | 1667 | } |
1670 | } else { | 1668 | } else { |
1671 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1669 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1672 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1670 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1673 | 0, 1 ); | 1671 | 0, 1 ); |
1674 | 1672 | ||
1675 | return; | 1673 | return; |
1676 | } | 1674 | } |
1677 | if ( loadbup ) { | 1675 | if ( loadbup ) { |
1678 | mView->openCalendar( fn ); | 1676 | mView->openCalendar( fn ); |
1679 | KOPrefs::instance()->mLastLoadFile = fn; | 1677 | KOPrefs::instance()->mLastLoadFile = fn; |
1680 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1678 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1681 | setCaption(mess); | 1679 | setCaption(mess); |
1682 | } | 1680 | } |
1683 | 1681 | ||
1684 | } | 1682 | } |
1685 | void MainWindow::quickImportIcal() | 1683 | void MainWindow::quickImportIcal() |
1686 | { | 1684 | { |
1687 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1685 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1688 | } | 1686 | } |
1689 | void MainWindow::importFile( QString fn, bool quick ) | 1687 | void MainWindow::importFile( QString fn, bool quick ) |
1690 | { | 1688 | { |
1691 | QFileInfo info; | 1689 | QFileInfo info; |
1692 | info.setFile( fn ); | 1690 | info.setFile( fn ); |
1693 | QString mess; | 1691 | QString mess; |
1694 | bool loadbup = true; | 1692 | bool loadbup = true; |
1695 | if ( !info. exists() ) { | 1693 | if ( !info. exists() ) { |
1696 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1694 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1697 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1695 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1698 | mess ); | 1696 | mess ); |
1699 | return; | 1697 | return; |
1700 | } | 1698 | } |
1701 | int result = 0; | 1699 | int result = 0; |
1702 | if ( !quick ) { | 1700 | if ( !quick ) { |
1703 | 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 )); | 1701 | 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 )); |
1704 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1702 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1705 | mess, | 1703 | mess, |
1706 | "Import", "Cancel", 0, | 1704 | "Import", "Cancel", 0, |
1707 | 0, 1 ); | 1705 | 0, 1 ); |
1708 | } | 1706 | } |
1709 | if ( result == 0 ) { | 1707 | if ( result == 0 ) { |
1710 | if ( mView->openCalendar( fn, true )) { | 1708 | if ( mView->openCalendar( fn, true )) { |
1711 | KOPrefs::instance()->mLastImportFile = fn; | 1709 | KOPrefs::instance()->mLastImportFile = fn; |
1712 | setCaption(i18n("Imported file successfully")); | 1710 | setCaption(i18n("Imported file successfully")); |
1713 | } else { | 1711 | } else { |
1714 | setCaption(i18n("Error importing file")); | 1712 | setCaption(i18n("Error importing file")); |
1715 | } | 1713 | } |
1716 | } | 1714 | } |
1717 | } | 1715 | } |
1718 | 1716 | ||
1719 | void MainWindow::importIcal() | 1717 | void MainWindow::importIcal() |
1720 | { | 1718 | { |
1721 | 1719 | ||
1722 | QString fn =KOPrefs::instance()->mLastImportFile; | 1720 | QString fn =KOPrefs::instance()->mLastImportFile; |
1723 | 1721 | ||
1724 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1722 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1725 | if ( fn == "" ) | 1723 | if ( fn == "" ) |
1726 | return; | 1724 | return; |
1727 | importFile( fn, true ); | 1725 | importFile( fn, true ); |
1728 | 1726 | ||
1729 | } | 1727 | } |
1730 | 1728 | ||
1731 | void MainWindow::exportVCalendar() | 1729 | void MainWindow::exportVCalendar() |
1732 | { | 1730 | { |
1733 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1731 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1734 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1732 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1735 | if ( fn == "" ) | 1733 | if ( fn == "" ) |
1736 | return; | 1734 | return; |
1737 | QFileInfo info; | 1735 | QFileInfo info; |
1738 | info.setFile( fn ); | 1736 | info.setFile( fn ); |
1739 | QString mes; | 1737 | QString mes; |
1740 | bool createbup = true; | 1738 | bool createbup = true; |
1741 | if ( info. exists() ) { | 1739 | if ( info. exists() ) { |
1742 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1740 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1743 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1744 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1742 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1745 | 0, 1 ); | 1743 | 0, 1 ); |
1746 | if ( result != 0 ) { | 1744 | if ( result != 0 ) { |
1747 | createbup = false; | 1745 | createbup = false; |
1748 | } | 1746 | } |
1749 | } | 1747 | } |
1750 | if ( createbup ) { | 1748 | if ( createbup ) { |
1751 | if ( mView->exportVCalendar( fn ) ) { | 1749 | if ( mView->exportVCalendar( fn ) ) { |
1752 | KOPrefs::instance()->mLastVcalFile = fn; | 1750 | KOPrefs::instance()->mLastVcalFile = fn; |
1753 | if ( fn.length() > 20 ) | 1751 | if ( fn.length() > 20 ) |
1754 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1752 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1755 | else | 1753 | else |
1756 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1754 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1757 | setCaption(mes); | 1755 | setCaption(mes); |
1758 | } | 1756 | } |
1759 | } | 1757 | } |
1760 | 1758 | ||
1761 | } | 1759 | } |
1762 | #include <qpushbutton.h> | 1760 | #include <qpushbutton.h> |
1763 | QString MainWindow::getPassword( ) | 1761 | QString MainWindow::getPassword( ) |
1764 | { | 1762 | { |
1765 | QString retfile = ""; | 1763 | QString retfile = ""; |
1766 | QDialog dia ( this, "input-dialog", true ); | 1764 | QDialog dia ( this, "input-dialog", true ); |
1767 | QLineEdit lab ( &dia ); | 1765 | QLineEdit lab ( &dia ); |
1768 | lab.setEchoMode( QLineEdit::Password ); | 1766 | lab.setEchoMode( QLineEdit::Password ); |
1769 | QVBoxLayout lay( &dia ); | 1767 | QVBoxLayout lay( &dia ); |
1770 | lay.setMargin(7); | 1768 | lay.setMargin(7); |
1771 | lay.setSpacing(7); | 1769 | lay.setSpacing(7); |
1772 | lay.addWidget( &lab); | 1770 | lay.addWidget( &lab); |
1773 | dia.setFixedSize( 230,50 ); | 1771 | dia.setFixedSize( 230,50 ); |
1774 | dia.setCaption( i18n("Enter password") ); | 1772 | dia.setCaption( i18n("Enter password") ); |
1775 | QPushButton pb ( "OK", &dia); | 1773 | QPushButton pb ( "OK", &dia); |
1776 | lay.addWidget( &pb ); | 1774 | lay.addWidget( &pb ); |
1777 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1775 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1778 | dia.show(); | 1776 | dia.show(); |
1779 | int res = dia.exec(); | 1777 | int res = dia.exec(); |
1780 | if ( res ) | 1778 | if ( res ) |
1781 | retfile = lab.text(); | 1779 | retfile = lab.text(); |
1782 | dia.hide(); | 1780 | dia.hide(); |
1783 | qApp->processEvents(); | 1781 | qApp->processEvents(); |
1784 | return retfile; | 1782 | return retfile; |
1785 | 1783 | ||
1786 | } | 1784 | } |
1787 | 1785 | ||
1788 | void MainWindow::syncLocalFile() | 1786 | void MainWindow::syncLocalFile() |
1789 | { | 1787 | { |
1790 | 1788 | ||
1791 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 1789 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
1792 | 1790 | ||
1793 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 1791 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
1794 | if ( fn == "" ) | 1792 | if ( fn == "" ) |
1795 | return; | 1793 | return; |
1796 | //mView->setSyncDevice("local-file" ); | 1794 | //mView->setSyncDevice("local-file" ); |
1797 | if ( syncWithFile( fn, false ) ) { | 1795 | if ( syncWithFile( fn, false ) ) { |
1798 | // Event* e = mView->getLastSyncEvent(); | 1796 | // Event* e = mView->getLastSyncEvent(); |
1799 | // e->setReadOnly( false ); | 1797 | // e->setReadOnly( false ); |
1800 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1798 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1801 | // e->setReadOnly( true ); | 1799 | // e->setReadOnly( true ); |
1802 | } | 1800 | } |
1803 | 1801 | ||
1804 | } | 1802 | } |
1805 | 1803 | ||
1806 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 1804 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
1807 | { | 1805 | { |
1808 | bool ret = false; | 1806 | bool ret = false; |
1809 | QFileInfo info; | 1807 | QFileInfo info; |
1810 | info.setFile( fn ); | 1808 | info.setFile( fn ); |