summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b1c7709..b597a6a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1214,915 +1214,921 @@ void MainWindow::keyBindings()
1214 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1214 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1215 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1215 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1216 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1216 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1217 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1217 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1218 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1218 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1219 i18n("<p><b>White</b>: Item readonly</p>\n"); 1219 i18n("<p><b>White</b>: Item readonly</p>\n");
1220 displayText( text, cap); 1220 displayText( text, cap);
1221 1221
1222} 1222}
1223void MainWindow::aboutAutoSaving() 1223void MainWindow::aboutAutoSaving()
1224{ 1224{
1225 QMessageBox* msg; 1225 QMessageBox* msg;
1226 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1226 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1227 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1227 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1228 QMessageBox::Ok, 1228 QMessageBox::Ok,
1229 QMessageBox::NoButton, 1229 QMessageBox::NoButton,
1230 QMessageBox::NoButton); 1230 QMessageBox::NoButton);
1231 msg->exec(); 1231 msg->exec();
1232 delete msg; 1232 delete msg;
1233 1233
1234 1234
1235} 1235}
1236void MainWindow::aboutKnownBugs() 1236void MainWindow::aboutKnownBugs()
1237{ 1237{
1238 QMessageBox* msg; 1238 QMessageBox* msg;
1239 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1239 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1240 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1240 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1241 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1241 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1242 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1242 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1243 i18n("\nor report them in the bugtracker on\n") + 1243 i18n("\nor report them in the bugtracker on\n") +
1244 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1244 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1245 QMessageBox::NoIcon, 1245 QMessageBox::NoIcon,
1246 QMessageBox::Ok, 1246 QMessageBox::Ok,
1247 QMessageBox::NoButton, 1247 QMessageBox::NoButton,
1248 QMessageBox::NoButton); 1248 QMessageBox::NoButton);
1249 msg->exec(); 1249 msg->exec();
1250 delete msg; 1250 delete msg;
1251 1251
1252} 1252}
1253 1253
1254QString MainWindow::defaultFileName() 1254QString MainWindow::defaultFileName()
1255{ 1255{
1256 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1256 return locateLocal( "data", "korganizer/mycalendar.ics" );
1257} 1257}
1258 1258
1259void MainWindow::processIncidenceSelection( Incidence *incidence ) 1259void MainWindow::processIncidenceSelection( Incidence *incidence )
1260{ 1260{
1261 if ( !incidence ) { 1261 if ( !incidence ) {
1262 enableIncidenceActions( false ); 1262 enableIncidenceActions( false );
1263 1263
1264 mNewSubTodoAction->setEnabled( false ); 1264 mNewSubTodoAction->setEnabled( false );
1265 setCaptionToDates(); 1265 setCaptionToDates();
1266 return; 1266 return;
1267 1267
1268 } 1268 }
1269 1269
1270 //KGlobal::locale()->formatDateTime(nextA, true); 1270 //KGlobal::locale()->formatDateTime(nextA, true);
1271 QString startString = ""; 1271 QString startString = "";
1272 if ( incidence->type() != "Todo" ) { 1272 if ( incidence->type() != "Todo" ) {
1273 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1273 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1274 if ( incidence->doesFloat() ) { 1274 if ( incidence->doesFloat() ) {
1275 startString += ": "+incidence->dtStartDateStr( true ); 1275 startString += ": "+incidence->dtStartDateStr( true );
1276 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1276 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1277 1277
1278 } else { 1278 } else {
1279 startString = ": "+incidence->dtStartStr(true); 1279 startString = ": "+incidence->dtStartStr(true);
1280 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1280 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1281 1281
1282 } 1282 }
1283 1283
1284 } else { 1284 } else {
1285 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1285 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1286 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1286 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1287 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1287 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1288 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1288 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1289 } 1289 }
1290 1290
1291 } 1291 }
1292 else 1292 else
1293 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1293 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1294 if ( !incidence->location().isEmpty() ) 1294 if ( !incidence->location().isEmpty() )
1295 startString += " (" +incidence->location()+")"; 1295 startString += " (" +incidence->location()+")";
1296 setCaption( incidence->summary()+startString); 1296 setCaption( incidence->summary()+startString);
1297 1297
1298 enableIncidenceActions( true ); 1298 enableIncidenceActions( true );
1299 1299
1300 if ( incidence->type() == "Event" ) { 1300 if ( incidence->type() == "Event" ) {
1301 mShowAction->setText( i18n("Show Event...") ); 1301 mShowAction->setText( i18n("Show Event...") );
1302 mEditAction->setText( i18n("Edit Event...") ); 1302 mEditAction->setText( i18n("Edit Event...") );
1303 mDeleteAction->setText( i18n("Delete Event...") ); 1303 mDeleteAction->setText( i18n("Delete Event...") );
1304 1304
1305 mNewSubTodoAction->setEnabled( false ); 1305 mNewSubTodoAction->setEnabled( false );
1306 } else if ( incidence->type() == "Todo" ) { 1306 } else if ( incidence->type() == "Todo" ) {
1307 mShowAction->setText( i18n("Show Todo...") ); 1307 mShowAction->setText( i18n("Show Todo...") );
1308 mEditAction->setText( i18n("Edit Todo...") ); 1308 mEditAction->setText( i18n("Edit Todo...") );
1309 mDeleteAction->setText( i18n("Delete Todo...") ); 1309 mDeleteAction->setText( i18n("Delete Todo...") );
1310 1310
1311 mNewSubTodoAction->setEnabled( true ); 1311 mNewSubTodoAction->setEnabled( true );
1312 } else { 1312 } else {
1313 mShowAction->setText( i18n("Show...") ); 1313 mShowAction->setText( i18n("Show...") );
1314 mShowAction->setText( i18n("Edit...") ); 1314 mShowAction->setText( i18n("Edit...") );
1315 mShowAction->setText( i18n("Delete...") ); 1315 mShowAction->setText( i18n("Delete...") );
1316 1316
1317 mNewSubTodoAction->setEnabled( false ); 1317 mNewSubTodoAction->setEnabled( false );
1318 } 1318 }
1319} 1319}
1320 1320
1321void MainWindow::enableIncidenceActions( bool enabled ) 1321void MainWindow::enableIncidenceActions( bool enabled )
1322{ 1322{
1323 mShowAction->setEnabled( enabled ); 1323 mShowAction->setEnabled( enabled );
1324 mEditAction->setEnabled( enabled ); 1324 mEditAction->setEnabled( enabled );
1325 mDeleteAction->setEnabled( enabled ); 1325 mDeleteAction->setEnabled( enabled );
1326} 1326}
1327 1327
1328void MainWindow::importOL() 1328void MainWindow::importOL()
1329{ 1329{
1330#ifdef _WIN32_ 1330#ifdef _WIN32_
1331 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1331 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1332 id->exec(); 1332 id->exec();
1333 delete id; 1333 delete id;
1334 mView->updateView(); 1334 mView->updateView();
1335#endif 1335#endif
1336} 1336}
1337void MainWindow::importBday() 1337void MainWindow::importBday()
1338{ 1338{
1339 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1339 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1340 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1340 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1341 i18n("Import!"), i18n("Cancel"), 0, 1341 i18n("Import!"), i18n("Cancel"), 0,
1342 0, 1 ); 1342 0, 1 );
1343 if ( result == 0 ) { 1343 if ( result == 0 ) {
1344 mView->importBday(); 1344 mView->importBday();
1345 1345
1346 } 1346 }
1347 1347
1348 1348
1349} 1349}
1350void MainWindow::importQtopia() 1350void MainWindow::importQtopia()
1351{ 1351{
1352#ifndef DESKTOP_VERSION 1352#ifndef DESKTOP_VERSION
1353 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1353 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1354 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"), 1354 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"),
1355 i18n("Import!"), i18n("Cancel"), 0, 1355 i18n("Import!"), i18n("Cancel"), 0,
1356 0, 1 ); 1356 0, 1 );
1357 if ( result == 0 ) { 1357 if ( result == 0 ) {
1358 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1358 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1359 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1359 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1360 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1360 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1361 mView->importQtopia( categories, datebook, todolist ); 1361 mView->importQtopia( categories, datebook, todolist );
1362 } 1362 }
1363#else 1363#else
1364 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1364 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1365 i18n("Not supported \non desktop!\n"), 1365 i18n("Not supported \non desktop!\n"),
1366 i18n("Ok"), i18n("Cancel"), 0, 1366 i18n("Ok"), i18n("Cancel"), 0,
1367 0, 1 ); 1367 0, 1 );
1368 1368
1369#endif 1369#endif
1370} 1370}
1371 1371
1372void MainWindow::saveOnClose() 1372void MainWindow::saveOnClose()
1373{ 1373{
1374 KOPrefs *p = KOPrefs::instance(); 1374 KOPrefs *p = KOPrefs::instance();
1375 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1375 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1376 p->mToolBarUp = iconToolBar->x() > width()/2 || 1376 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1377 iconToolBar->y() > height()/2; 1377 iconToolBar->y() > height()/2;
1378 mView->writeSettings(); 1378 mView->writeSettings();
1379 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1379 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1380 save(); 1380 save();
1381} 1381}
1382void MainWindow::slotModifiedChanged( bool changed ) 1382void MainWindow::slotModifiedChanged( bool changed )
1383{ 1383{
1384 if ( mBlockAtStartup ) 1384 if ( mBlockAtStartup )
1385 return; 1385 return;
1386 int msec; 1386 int msec;
1387 // we store the changes after 1 minute, 1387 // we store the changes after 1 minute,
1388 // and for safety reasons after 10 minutes again 1388 // and for safety reasons after 10 minutes again
1389 if ( !mBlockSaveFlag ) 1389 if ( !mBlockSaveFlag )
1390 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1390 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1391 else 1391 else
1392 msec = 1000 * 600; 1392 msec = 1000 * 600;
1393 mSaveTimer.start( msec, true ); // 1 minute 1393 mSaveTimer.start( msec, true ); // 1 minute
1394 qDebug("KO: Saving File in %d secs!", msec/1000); 1394 qDebug("KO: Saving File in %d secs!", msec/1000);
1395 mCalendarModifiedFlag = true; 1395 mCalendarModifiedFlag = true;
1396} 1396}
1397#include <qfileinfo.h> 1397#include <qfileinfo.h>
1398void MainWindow::save() 1398void MainWindow::save()
1399{ 1399{
1400 if ( mBlockSaveFlag ) 1400 if ( mBlockSaveFlag )
1401 return; 1401 return;
1402 bool store = mBlockSaveFlag; 1402 bool store = mBlockSaveFlag;
1403 mBlockSaveFlag = true; 1403 mBlockSaveFlag = true;
1404 if ( mView->checkFileVersion( defaultFileName()) ) { 1404 if ( mView->checkFileVersion( defaultFileName()) ) {
1405 1405
1406 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1406 QTime neededSaveTime = QDateTime::currentDateTime().time();
1407 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1407 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1408 qDebug("KO: Start saving data to file!"); 1408 qDebug("KO: Start saving data to file!");
1409 mView->saveCalendar( defaultFileName() ); 1409 mView->saveCalendar( defaultFileName() );
1410 1410
1411 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1411 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1412 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1412 mView->setLoadedFileVersion(QDateTime::currentDateTime());
1413 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1413 qDebug("KO: Needed %d ms for saving.",msNeeded );
1414 QString savemes; 1414 QString savemes;
1415 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1415 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1416 setCaption(savemes); 1416 setCaption(savemes);
1417 } else 1417 } else
1418 setCaption(i18n("Saving cancelled!")); 1418 setCaption(i18n("Saving cancelled!"));
1419 mCalendarModifiedFlag = false; 1419 mCalendarModifiedFlag = false;
1420 mBlockSaveFlag = store; 1420 mBlockSaveFlag = store;
1421} 1421}
1422 1422
1423void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1423void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1424{ 1424{
1425 if ( !e->isAutoRepeat() ) { 1425 if ( !e->isAutoRepeat() ) {
1426 mFlagKeyPressed = false; 1426 mFlagKeyPressed = false;
1427 } 1427 }
1428} 1428}
1429void MainWindow::keyPressEvent ( QKeyEvent * e ) 1429void MainWindow::keyPressEvent ( QKeyEvent * e )
1430{ 1430{
1431 qApp->processEvents(); 1431 qApp->processEvents();
1432 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1432 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1433 e->ignore(); 1433 e->ignore();
1434 // qDebug(" ignore %d",e->isAutoRepeat() ); 1434 // qDebug(" ignore %d",e->isAutoRepeat() );
1435 return; 1435 return;
1436 } 1436 }
1437 if (! e->isAutoRepeat() ) 1437 if (! e->isAutoRepeat() )
1438 mFlagKeyPressed = true; 1438 mFlagKeyPressed = true;
1439 KOPrefs *p = KOPrefs::instance(); 1439 KOPrefs *p = KOPrefs::instance();
1440 bool showSelectedDates = false; 1440 bool showSelectedDates = false;
1441 int size; 1441 int size;
1442 int pro = 0; 1442 int pro = 0;
1443 //qDebug("MainWindow::keyPressEvent "); 1443 //qDebug("MainWindow::keyPressEvent ");
1444 switch ( e->key() ) { 1444 switch ( e->key() ) {
1445 case Qt::Key_Right: 1445 case Qt::Key_Right:
1446 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1446 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1447 mView->goNextMonth(); 1447 mView->goNextMonth();
1448 else 1448 else
1449 mView->goNext(); 1449 mView->goNext();
1450 showSelectedDates = true; 1450 showSelectedDates = true;
1451 break; 1451 break;
1452 case Qt::Key_Left: 1452 case Qt::Key_Left:
1453 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1453 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1454 mView->goPreviousMonth(); 1454 mView->goPreviousMonth();
1455 else 1455 else
1456 mView->goPrevious(); 1456 mView->goPrevious();
1457 showSelectedDates = true; 1457 showSelectedDates = true;
1458 break; 1458 break;
1459 case Qt::Key_Down: 1459 case Qt::Key_Down:
1460 mView->viewManager()->agendaView()->scrollOneHourDown(); 1460 mView->viewManager()->agendaView()->scrollOneHourDown();
1461 break; 1461 break;
1462 case Qt::Key_Up: 1462 case Qt::Key_Up:
1463 mView->viewManager()->agendaView()->scrollOneHourUp(); 1463 mView->viewManager()->agendaView()->scrollOneHourUp();
1464 break; 1464 break;
1465 case Qt::Key_I: 1465 case Qt::Key_I:
1466 mView->showIncidence(); 1466 mView->showIncidence();
1467 break; 1467 break;
1468 case Qt::Key_Delete: 1468 case Qt::Key_Delete:
1469 case Qt::Key_Backspace: 1469 case Qt::Key_Backspace:
1470 mView->deleteIncidence(); 1470 mView->deleteIncidence();
1471 break; 1471 break;
1472 case Qt::Key_D: 1472 case Qt::Key_D:
1473 mView->viewManager()->showDayView(); 1473 mView->viewManager()->showDayView();
1474 showSelectedDates = true; 1474 showSelectedDates = true;
1475 break; 1475 break;
1476 case Qt::Key_O: 1476 case Qt::Key_O:
1477 mView->toggleFilerEnabled( ); 1477 mView->toggleFilerEnabled( );
1478 break; 1478 break;
1479 case Qt::Key_0: 1479 case Qt::Key_0:
1480 case Qt::Key_1: 1480 case Qt::Key_1:
1481 case Qt::Key_2: 1481 case Qt::Key_2:
1482 case Qt::Key_3: 1482 case Qt::Key_3:
1483 case Qt::Key_4: 1483 case Qt::Key_4:
1484 case Qt::Key_5: 1484 case Qt::Key_5:
1485 case Qt::Key_6: 1485 case Qt::Key_6:
1486 case Qt::Key_7: 1486 case Qt::Key_7:
1487 case Qt::Key_8: 1487 case Qt::Key_8:
1488 case Qt::Key_9: 1488 case Qt::Key_9:
1489 pro = e->key()-48; 1489 pro = e->key()-48;
1490 if ( pro == 0 ) 1490 if ( pro == 0 )
1491 pro = 10; 1491 pro = 10;
1492 if ( e->state() == Qt::ControlButton) 1492 if ( e->state() == Qt::ControlButton)
1493 pro += 10; 1493 pro += 10;
1494 break; 1494 break;
1495 case Qt::Key_M: 1495 case Qt::Key_M:
1496 mView->viewManager()->showMonthView(); 1496 mView->viewManager()->showMonthView();
1497 showSelectedDates = true; 1497 showSelectedDates = true;
1498 break; 1498 break;
1499 case Qt::Key_Insert: 1499 case Qt::Key_Insert:
1500 mView->newEvent(); 1500 mView->newEvent();
1501 break; 1501 break;
1502 case Qt::Key_S : 1502 case Qt::Key_S :
1503 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1503 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1504 mView->newSubTodo(); 1504 mView->newSubTodo();
1505 else 1505 else
1506 mView->dialogManager()->showSearchDialog(); 1506 mView->dialogManager()->showSearchDialog();
1507 break; 1507 break;
1508 case Qt::Key_Y : 1508 case Qt::Key_Y :
1509 case Qt::Key_Z : 1509 case Qt::Key_Z :
1510 mView->viewManager()->showWorkWeekView(); 1510 mView->viewManager()->showWorkWeekView();
1511 showSelectedDates = true; 1511 showSelectedDates = true;
1512 break; 1512 break;
1513 case Qt::Key_U : 1513 case Qt::Key_U :
1514 mView->viewManager()->showWeekView(); 1514 mView->viewManager()->showWeekView();
1515 showSelectedDates = true; 1515 showSelectedDates = true;
1516 break; 1516 break;
1517 case Qt::Key_H : 1517 case Qt::Key_H :
1518 keyBindings(); 1518 keyBindings();
1519 break; 1519 break;
1520 case Qt::Key_W: 1520 case Qt::Key_W:
1521 mView->viewManager()->showWhatsNextView(); 1521 mView->viewManager()->showWhatsNextView();
1522 break; 1522 break;
1523 case Qt::Key_L: 1523 case Qt::Key_L:
1524 mView->viewManager()->showListView(); 1524 mView->viewManager()->showListView();
1525 break; 1525 break;
1526 case Qt::Key_N: 1526 case Qt::Key_N:
1527 mView->viewManager()->showNextXView(); 1527 mView->viewManager()->showNextXView();
1528 showSelectedDates = true; 1528 showSelectedDates = true;
1529 break; 1529 break;
1530 case Qt::Key_V: 1530 case Qt::Key_V:
1531 mView->viewManager()->showTodoView(); 1531 mView->viewManager()->showTodoView();
1532 break; 1532 break;
1533 case Qt::Key_C: 1533 case Qt::Key_C:
1534 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1534 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1535 break; 1535 break;
1536 case Qt::Key_P: 1536 case Qt::Key_P:
1537 mView->showDatePicker( ); 1537 mView->showDatePicker( );
1538 break; 1538 break;
1539 case Qt::Key_F: 1539 case Qt::Key_F:
1540 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1540 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1541 mView->editFilters(); 1541 mView->editFilters();
1542 else 1542 else
1543 mView->toggleFilter(); 1543 mView->toggleFilter();
1544 break; 1544 break;
1545 case Qt::Key_X: 1545 case Qt::Key_X:
1546 mView->toggleDateNavigatorWidget(); 1546 mView->toggleDateNavigatorWidget();
1547 break; 1547 break;
1548 case Qt::Key_Space: 1548 case Qt::Key_Space:
1549 mView->toggleExpand(); 1549 mView->toggleExpand();
1550 break; 1550 break;
1551 case Qt::Key_A: 1551 case Qt::Key_A:
1552 mView->toggleAllDaySize(); 1552 mView->toggleAllDaySize();
1553 break; 1553 break;
1554 case Qt::Key_T: 1554 case Qt::Key_T:
1555 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1555 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1556 mView->newTodo(); 1556 mView->newTodo();
1557 else { 1557 else {
1558 mView->goToday(); 1558 mView->goToday();
1559 showSelectedDates = true; 1559 showSelectedDates = true;
1560 } 1560 }
1561 break; 1561 break;
1562 case Qt::Key_J: 1562 case Qt::Key_J:
1563 mView->viewManager()->showJournalView(); 1563 mView->viewManager()->showJournalView();
1564 break; 1564 break;
1565 case Qt::Key_B: 1565 case Qt::Key_B:
1566 mView->editIncidenceDescription();; 1566 mView->editIncidenceDescription();;
1567 break; 1567 break;
1568 // case Qt::Key_Return: 1568 // case Qt::Key_Return:
1569 case Qt::Key_E: 1569 case Qt::Key_E:
1570 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1570 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1571 mView->newEvent(); 1571 mView->newEvent();
1572 else 1572 else
1573 mView->editIncidence(); 1573 mView->editIncidence();
1574 break; 1574 break;
1575 case Qt::Key_Plus: 1575 case Qt::Key_Plus:
1576 size = p->mHourSize +2; 1576 size = p->mHourSize +2;
1577 if ( size <= 18 ) 1577 if ( size <= 18 )
1578 configureAgenda( size ); 1578 configureAgenda( size );
1579 break; 1579 break;
1580 case Qt::Key_Minus: 1580 case Qt::Key_Minus:
1581 size = p->mHourSize - 2; 1581 size = p->mHourSize - 2;
1582 if ( size >= 4 ) 1582 if ( size >= 4 )
1583 configureAgenda( size ); 1583 configureAgenda( size );
1584 break; 1584 break;
1585 1585
1586 1586
1587 default: 1587 default:
1588 e->ignore(); 1588 e->ignore();
1589 } 1589 }
1590 if ( pro > 0 ) { 1590 if ( pro > 0 ) {
1591 mView->selectFilter( pro-1 ); 1591 mView->selectFilter( pro-1 );
1592 } 1592 }
1593 if ( showSelectedDates ) { 1593 if ( showSelectedDates ) {
1594 ;// setCaptionToDates(); 1594 ;// setCaptionToDates();
1595 } 1595 }
1596 1596
1597} 1597}
1598 1598
1599void MainWindow::fillFilterMenu() 1599void MainWindow::fillFilterMenu()
1600{ 1600{
1601 selectFilterMenu->clear(); 1601 selectFilterMenu->clear();
1602 bool disable = false; 1602 bool disable = false;
1603 if ( mView->filterView()->filtersEnabled() ) { 1603 if ( mView->filterView()->filtersEnabled() ) {
1604 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1604 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1605 } 1605 }
1606 else { 1606 else {
1607 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1607 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1608 disable = true; 1608 disable = true;
1609 } 1609 }
1610 selectFilterMenu->insertSeparator(); 1610 selectFilterMenu->insertSeparator();
1611 QPtrList<CalFilter> fili = mView->filters(); 1611 QPtrList<CalFilter> fili = mView->filters();
1612 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1612 CalFilter *curfilter = mView->filterView()->selectedFilter();
1613 CalFilter *filter = fili.first(); 1613 CalFilter *filter = fili.first();
1614 int iii = 1; 1614 int iii = 1;
1615 while(filter) { 1615 while(filter) {
1616 selectFilterMenu->insertItem( filter->name(), iii ); 1616 selectFilterMenu->insertItem( filter->name(), iii );
1617 if ( filter == curfilter) 1617 if ( filter == curfilter)
1618 selectFilterMenu->setItemChecked( iii, true ); 1618 selectFilterMenu->setItemChecked( iii, true );
1619 if ( disable ) 1619 if ( disable )
1620 selectFilterMenu->setItemEnabled( iii, false ); 1620 selectFilterMenu->setItemEnabled( iii, false );
1621 filter = fili.next(); 1621 filter = fili.next();
1622 ++iii; 1622 ++iii;
1623 } 1623 }
1624} 1624}
1625void MainWindow::selectFilter( int fil ) 1625void MainWindow::selectFilter( int fil )
1626{ 1626{
1627 if ( fil == 0 ) { 1627 if ( fil == 0 ) {
1628 mView->toggleFilerEnabled( ); 1628 mView->toggleFilerEnabled( );
1629 } else { 1629 } else {
1630 mView->selectFilter( fil-1 ); 1630 mView->selectFilter( fil-1 );
1631 } 1631 }
1632} 1632}
1633void MainWindow::configureToolBar( int item ) 1633void MainWindow::configureToolBar( int item )
1634{ 1634{
1635 1635
1636 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1636 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1637 KOPrefs *p = KOPrefs::instance(); 1637 KOPrefs *p = KOPrefs::instance();
1638 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1638 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1639 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1639 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1640 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1640 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1641 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1641 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1642 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1642 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1643 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1643 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1644 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1644 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1645 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1645 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1646 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1646 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1647 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1647 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1648 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1648 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1649 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1649 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1650 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1650 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1651 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1651 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1652 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1652 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1653 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1653 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1654 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1654 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1655 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1655 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1656 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1656 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1657 // initActions(); 1657 // initActions();
1658} 1658}
1659 1659
1660void MainWindow::setCaptionToDates() 1660void MainWindow::setCaptionToDates()
1661{ 1661{
1662 QString selDates; 1662 QString selDates;
1663 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1663 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1664 if (mView->startDate() < mView->endDate() ) 1664 if (mView->startDate() < mView->endDate() )
1665 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1665 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1666 setCaption( i18n("Dates: ") + selDates ); 1666 setCaption( i18n("Dates: ") + selDates );
1667 1667
1668} 1668}
1669// parameter item == 0: reinit 1669// parameter item == 0: reinit
1670void MainWindow::configureAgenda( int item ) 1670void MainWindow::configureAgenda( int item )
1671{ 1671{
1672 1672
1673 KOPrefs *p = KOPrefs::instance(); 1673 KOPrefs *p = KOPrefs::instance();
1674 1674
1675 int i; 1675 int i;
1676 if ( item == 1 ) { 1676 if ( item == 1 ) {
1677 mView->toggleAllDaySize(); 1677 mView->toggleAllDaySize();
1678 return; 1678 return;
1679 } 1679 }
1680 // do not allow 4 for widgets higher than 480 1680 // do not allow 4 for widgets higher than 480
1681 // if ( QApplication::desktop()->height() > 480 ) { 1681 // if ( QApplication::desktop()->height() > 480 ) {
1682// if ( item == 4 ) 1682// if ( item == 4 )
1683// item = 6; 1683// item = 6;
1684// } 1684// }
1685 for ( i = 4; i <= 18; i= i+2 ) 1685 for ( i = 4; i <= 18; i= i+2 )
1686 configureAgendaMenu->setItemChecked( i, false ); 1686 configureAgendaMenu->setItemChecked( i, false );
1687 configureAgendaMenu->setItemChecked( item, true ); 1687 configureAgendaMenu->setItemChecked( item, true );
1688 if ( p->mHourSize == item ) 1688 if ( p->mHourSize == item )
1689 return; 1689 return;
1690 p->mHourSize=item; 1690 p->mHourSize=item;
1691 mView->viewManager()->agendaView()->updateConfig(); 1691 mView->viewManager()->agendaView()->updateConfig();
1692} 1692}
1693 1693
1694void MainWindow::saveCalendar() 1694void MainWindow::saveCalendar()
1695{ 1695{
1696 QString fn = KOPrefs::instance()->mLastSaveFile; 1696 QString fn = KOPrefs::instance()->mLastSaveFile;
1697 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1697 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1698 1698
1699 if ( fn == "" ) 1699 if ( fn == "" )
1700 return; 1700 return;
1701 QFileInfo info; 1701 QFileInfo info;
1702 info.setFile( fn ); 1702 info.setFile( fn );
1703 QString mes; 1703 QString mes;
1704 bool createbup = true; 1704 bool createbup = true;
1705 if ( info. exists() ) { 1705 if ( info. exists() ) {
1706 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1706 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1707 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1707 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1708 i18n("Overwrite!"), i18n("Cancel"), 0, 1708 i18n("Overwrite!"), i18n("Cancel"), 0,
1709 0, 1 ); 1709 0, 1 );
1710 if ( result != 0 ) { 1710 if ( result != 0 ) {
1711 createbup = false; 1711 createbup = false;
1712 } 1712 }
1713 } 1713 }
1714 if ( createbup ) { 1714 if ( createbup ) {
1715 mView->saveCalendar( fn ); 1715 mView->saveCalendar( fn );
1716 mes = i18n("KO/Pi:Saved %1").arg(fn); 1716 mes = i18n("KO/Pi:Saved %1").arg(fn);
1717 KOPrefs::instance()->mLastSaveFile = fn; 1717 KOPrefs::instance()->mLastSaveFile = fn;
1718 setCaption(mes); 1718 setCaption(mes);
1719 } 1719 }
1720} 1720}
1721void MainWindow::loadCalendar() 1721void MainWindow::loadCalendar()
1722{ 1722{
1723 1723
1724 QString fn = KOPrefs::instance()->mLastLoadFile; 1724 QString fn = KOPrefs::instance()->mLastLoadFile;
1725 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1725 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1726 1726
1727 if ( fn == "" ) 1727 if ( fn == "" )
1728 return; 1728 return;
1729 QFileInfo info; 1729 QFileInfo info;
1730 info.setFile( fn ); 1730 info.setFile( fn );
1731 QString mess; 1731 QString mess;
1732 bool loadbup = true; 1732 bool loadbup = true;
1733 if ( info. exists() ) { 1733 if ( info. exists() ) {
1734 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1734 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1735 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1735 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1736 mess, 1736 mess,
1737 i18n("Load!"), i18n("Cancel"), 0, 1737 i18n("Load!"), i18n("Cancel"), 0,
1738 0, 1 ); 1738 0, 1 );
1739 if ( result != 0 ) { 1739 if ( result != 0 ) {
1740 loadbup = false; 1740 loadbup = false;
1741 } 1741 }
1742 } else { 1742 } else {
1743 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1743 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1744 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1744 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1745 0, 1 ); 1745 0, 1 );
1746 1746
1747 return; 1747 return;
1748 } 1748 }
1749 if ( loadbup ) { 1749 if ( loadbup ) {
1750 mView->openCalendar( fn ); 1750 mView->openCalendar( fn );
1751 KOPrefs::instance()->mLastLoadFile = fn; 1751 KOPrefs::instance()->mLastLoadFile = fn;
1752 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1752 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1753 setCaption(mess); 1753 setCaption(mess);
1754 } 1754 }
1755 1755
1756} 1756}
1757void MainWindow::quickImportIcal() 1757void MainWindow::quickImportIcal()
1758{ 1758{
1759 importFile( KOPrefs::instance()->mLastImportFile, false ); 1759 importFile( KOPrefs::instance()->mLastImportFile, false );
1760} 1760}
1761void MainWindow::importFile( QString fn, bool quick ) 1761void MainWindow::importFile( QString fn, bool quick )
1762{ 1762{
1763 QFileInfo info; 1763 QFileInfo info;
1764 info.setFile( fn ); 1764 info.setFile( fn );
1765 QString mess; 1765 QString mess;
1766 bool loadbup = true; 1766 bool loadbup = true;
1767 if ( !info. exists() ) { 1767 if ( !info. exists() ) {
1768 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1768 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1769 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1769 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1770 mess ); 1770 mess );
1771 return; 1771 return;
1772 } 1772 }
1773 int result = 0; 1773 int result = 0;
1774 if ( !quick ) { 1774 if ( !quick ) {
1775 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 )); 1775 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 ));
1776 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1776 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1777 mess, 1777 mess,
1778 "Import", "Cancel", 0, 1778 "Import", "Cancel", 0,
1779 0, 1 ); 1779 0, 1 );
1780 } 1780 }
1781 if ( result == 0 ) { 1781 if ( result == 0 ) {
1782 if ( mView->openCalendar( fn, true )) { 1782 if ( mView->openCalendar( fn, true )) {
1783 KOPrefs::instance()->mLastImportFile = fn; 1783 KOPrefs::instance()->mLastImportFile = fn;
1784 setCaption(i18n("Imported file successfully")); 1784 setCaption(i18n("Imported file successfully"));
1785 } else { 1785 } else {
1786 setCaption(i18n("Error importing file")); 1786 setCaption(i18n("Error importing file"));
1787 } 1787 }
1788 } 1788 }
1789} 1789}
1790 1790
1791void MainWindow::importIcal() 1791void MainWindow::importIcal()
1792{ 1792{
1793 1793
1794 QString fn =KOPrefs::instance()->mLastImportFile; 1794 QString fn =KOPrefs::instance()->mLastImportFile;
1795 1795
1796 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1796 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1797 if ( fn == "" ) 1797 if ( fn == "" )
1798 return; 1798 return;
1799 importFile( fn, true ); 1799 importFile( fn, true );
1800 1800
1801} 1801}
1802 1802
1803void MainWindow::exportVCalendar() 1803void MainWindow::exportVCalendar()
1804{ 1804{
1805 QString fn = KOPrefs::instance()->mLastVcalFile; 1805 QString fn = KOPrefs::instance()->mLastVcalFile;
1806 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1806 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1807 if ( fn == "" ) 1807 if ( fn == "" )
1808 return; 1808 return;
1809 QFileInfo info; 1809 QFileInfo info;
1810 info.setFile( fn ); 1810 info.setFile( fn );
1811 QString mes; 1811 QString mes;
1812 bool createbup = true; 1812 bool createbup = true;
1813 if ( info. exists() ) { 1813 if ( info. exists() ) {
1814 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1814 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1815 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1815 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1816 i18n("Overwrite!"), i18n("Cancel"), 0, 1816 i18n("Overwrite!"), i18n("Cancel"), 0,
1817 0, 1 ); 1817 0, 1 );
1818 if ( result != 0 ) { 1818 if ( result != 0 ) {
1819 createbup = false; 1819 createbup = false;
1820 } 1820 }
1821 } 1821 }
1822 if ( createbup ) { 1822 if ( createbup ) {
1823 if ( mView->exportVCalendar( fn ) ) { 1823 if ( mView->exportVCalendar( fn ) ) {
1824 KOPrefs::instance()->mLastVcalFile = fn; 1824 KOPrefs::instance()->mLastVcalFile = fn;
1825 if ( fn.length() > 20 ) 1825 if ( fn.length() > 20 )
1826 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1826 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1827 else 1827 else
1828 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1828 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1829 setCaption(mes); 1829 setCaption(mes);
1830 } 1830 }
1831 } 1831 }
1832 1832
1833} 1833}
1834#include <qpushbutton.h> 1834#include <qpushbutton.h>
1835QString MainWindow::getPassword( ) 1835QString MainWindow::getPassword( )
1836{ 1836{
1837 QString retfile = ""; 1837 QString retfile = "";
1838 QDialog dia ( this, "input-dialog", true ); 1838 QDialog dia ( this, "input-dialog", true );
1839 QLineEdit lab ( &dia ); 1839 QLineEdit lab ( &dia );
1840 lab.setEchoMode( QLineEdit::Password ); 1840 lab.setEchoMode( QLineEdit::Password );
1841 QVBoxLayout lay( &dia ); 1841 QVBoxLayout lay( &dia );
1842 lay.setMargin(7); 1842 lay.setMargin(7);
1843 lay.setSpacing(7); 1843 lay.setSpacing(7);
1844 lay.addWidget( &lab); 1844 lay.addWidget( &lab);
1845 dia.setFixedSize( 230,50 ); 1845 dia.setFixedSize( 230,50 );
1846 dia.setCaption( i18n("Enter password") ); 1846 dia.setCaption( i18n("Enter password") );
1847 QPushButton pb ( "OK", &dia); 1847 QPushButton pb ( "OK", &dia);
1848 lay.addWidget( &pb ); 1848 lay.addWidget( &pb );
1849 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1849 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1850 dia.show(); 1850 dia.show();
1851 int res = dia.exec(); 1851 int res = dia.exec();
1852 if ( res ) 1852 if ( res )
1853 retfile = lab.text(); 1853 retfile = lab.text();
1854 dia.hide(); 1854 dia.hide();
1855 qApp->processEvents(); 1855 qApp->processEvents();
1856 return retfile; 1856 return retfile;
1857 1857
1858} 1858}
1859 1859
1860void MainWindow::syncLocalFile() 1860void MainWindow::syncLocalFile()
1861{ 1861{
1862 1862
1863 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 1863 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
1864 1864
1865 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 1865 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
1866 if ( fn == "" ) 1866 if ( fn == "" )
1867 return; 1867 return;
1868 //mView->setSyncDevice("local-file" ); 1868 //mView->setSyncDevice("local-file" );
1869 if ( syncWithFile( fn, false ) ) { 1869 if ( syncWithFile( fn, false ) ) {
1870 // Event* e = mView->getLastSyncEvent(); 1870 // Event* e = mView->getLastSyncEvent();
1871// e->setReadOnly( false ); 1871// e->setReadOnly( false );
1872// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1872// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1873// e->setReadOnly( true ); 1873// e->setReadOnly( true );
1874 } 1874 }
1875 1875
1876} 1876}
1877 1877
1878bool MainWindow::syncWithFile( QString fn , bool quick ) 1878bool MainWindow::syncWithFile( QString fn , bool quick )
1879{ 1879{
1880 bool ret = false; 1880 bool ret = false;
1881 QFileInfo info; 1881 QFileInfo info;
1882 info.setFile( fn ); 1882 info.setFile( fn );
1883 QString mess; 1883 QString mess;
1884 bool loadbup = true; 1884 bool loadbup = true;
1885 if ( !info. exists() ) { 1885 if ( !info. exists() ) {
1886 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 1886 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
1887 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1887 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1888 mess ); 1888 mess );
1889 return ret; 1889 return ret;
1890 } 1890 }
1891 int result = 0; 1891 int result = 0;
1892 if ( !quick ) { 1892 if ( !quick ) {
1893 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1893 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1894 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1894 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1895 mess, 1895 mess,
1896 i18n("Sync"), i18n("Cancel"), 0, 1896 i18n("Sync"), i18n("Cancel"), 0,
1897 0, 1 ); 1897 0, 1 );
1898 if ( result ) 1898 if ( result )
1899 return false; 1899 return false;
1900 } 1900 }
1901 if ( KOPrefs::instance()->mAskForPreferences ) 1901 if ( KOPrefs::instance()->mAskForPreferences )
1902 mView->edit_sync_options(); 1902 mView->edit_sync_options();
1903 if ( result == 0 ) { 1903 if ( result == 0 ) {
1904 //qDebug("Now sycing ... "); 1904 //qDebug("Now sycing ... ");
1905 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) 1905 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
1906 setCaption( i18n("Synchronization successful") ); 1906 setCaption( i18n("Synchronization successful") );
1907 else 1907 else
1908 setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 1908 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
1909 if ( ! quick ) 1909 if ( ! quick )
1910 KOPrefs::instance()->mLastSyncedLocalFile = fn; 1910 KOPrefs::instance()->mLastSyncedLocalFile = fn;
1911 slotModifiedChanged( true ); 1911 slotModifiedChanged( true );
1912 } 1912 }
1913 return ret; 1913 return ret;
1914} 1914}
1915void MainWindow::quickSyncLocalFile() 1915void MainWindow::quickSyncLocalFile()
1916{ 1916{
1917 //mView->setSyncDevice("local-file" ); 1917 //mView->setSyncDevice("local-file" );
1918 //qDebug("quickSyncLocalFile() "); 1918 //qDebug("quickSyncLocalFile() ");
1919 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 1919 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
1920 // Event* e = mView->getLastSyncEvent(); 1920 // Event* e = mView->getLastSyncEvent();
1921// e->setReadOnly( false ); 1921// e->setReadOnly( false );
1922// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1922// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1923// e->setReadOnly( true ); 1923// e->setReadOnly( true );
1924 1924
1925 } 1925 }
1926} 1926}
1927 1927
1928void MainWindow::confSync() 1928void MainWindow::confSync()
1929{ 1929{
1930 mView->confSync(); 1930 mView->confSync();
1931 fillSyncMenu(); 1931 fillSyncMenu();
1932} 1932}
1933void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 1933void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
1934{ 1934{
1935 QString question; 1935 QString question;
1936 if ( ask ) { 1936 if ( ask ) {
1937 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 1937 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
1938 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1938 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1939 question, 1939 question,
1940 i18n("Yes"), i18n("No"), 1940 i18n("Yes"), i18n("No"),
1941 0, 0 ) != 0 ) 1941 0, 0 ) != 0 )
1942 return; 1942 return;
1943 } 1943 }
1944 QString command = prof->getPreSyncCommand(); 1944 QString command = prof->getPreSyncCommand();
1945 int fi; 1945 int fi;
1946 if ( (fi = command.find("$PWD$")) > 0 ) { 1946 if ( (fi = command.find("$PWD$")) > 0 ) {
1947 QString pwd = getPassword(); 1947 QString pwd = getPassword();
1948 command = command.left( fi )+ pwd + command.mid( fi+5 ); 1948 command = command.left( fi )+ pwd + command.mid( fi+5 );
1949 1949
1950 } 1950 }
1951 int maxlen = 30; 1951 int maxlen = 30;
1952 if ( QApplication::desktop()->width() > 320 ) 1952 if ( QApplication::desktop()->width() > 320 )
1953 maxlen += 25; 1953 maxlen += 25;
1954 setCaption ( i18n( "Copy remote file to local machine..." ) ); 1954 setCaption ( i18n( "Copy remote file to local machine..." ) );
1955 int fileSize = 0; 1955 int fileSize = 0;
1956 int result = system ( command ); 1956 int result = system ( command );
1957 // 0 : okay 1957 // 0 : okay
1958 // 256: no such file or dir 1958 // 256: no such file or dir
1959 // 1959 //
1960 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 1960 qDebug("KO: Remote copy result(0 = okay): %d ",result );
1961 if ( result != 0 ) { 1961 if ( result != 0 ) {
1962 int len = maxlen; 1962 int len = maxlen;
1963 while ( len < command.length() ) { 1963 while ( len < command.length() ) {
1964 command.insert( len , "\n" ); 1964 command.insert( len , "\n" );
1965 len += maxlen +2; 1965 len += maxlen +2;
1966 } 1966 }
1967 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 1967 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
1968 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1968 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1969 question, 1969 question,
1970 i18n("Okay!")) ; 1970 i18n("Okay!")) ;
1971 setCaption ("KO/Pi"); 1971 setCaption ("KO/Pi");
1972 return; 1972 return;
1973 } 1973 }
1974 setCaption ( i18n( "Copying succeed." ) ); 1974 setCaption ( i18n( "Copying succeed." ) );
1975 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 1975 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
1976 if ( syncWithFile( prof->getLocalTempFile(), true ) ) { 1976 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
1977// Event* e = mView->getLastSyncEvent(); 1977// Event* e = mView->getLastSyncEvent();
1978// e->setReadOnly( false ); 1978// e->setReadOnly( false );
1979// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1979// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1980// e->setReadOnly( true ); 1980// e->setReadOnly( true );
1981 if ( KOPrefs::instance()->mWriteBackFile ) { 1981 if ( KOPrefs::instance()->mWriteBackFile ) {
1982 command = prof->getPostSyncCommand(); 1982 command = prof->getPostSyncCommand();
1983 int fi;
1984 if ( (fi = command.find("$PWD$")) > 0 ) {
1985 QString pwd = getPassword();
1986 command = command.left( fi )+ pwd + command.mid( fi+5 );
1987
1988 }
1983 setCaption ( i18n( "Writing back file ..." ) ); 1989 setCaption ( i18n( "Writing back file ..." ) );
1984 result = system ( command ); 1990 result = system ( command );
1985 qDebug("KO: Writing back file result: %d ", result); 1991 qDebug("KO: Writing back file result: %d ", result);
1986 if ( result != 0 ) { 1992 if ( result != 0 ) {
1987 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 1993 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
1988 return; 1994 return;
1989 } else { 1995 } else {
1990 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 1996 setCaption ( i18n( "Syncronization sucessfully completed" ) );
1991 } 1997 }
1992 } 1998 }
1993 } 1999 }
1994 return; 2000 return;
1995} 2001}
1996void MainWindow::syncSSH() 2002void MainWindow::syncSSH()
1997{ 2003{
1998 // not used anymore 2004 // not used anymore
1999 QTime timer; 2005 QTime timer;
2000 timer.start(); 2006 timer.start();
2001 //qDebug("MainWindow::syncssh() "); 2007 //qDebug("MainWindow::syncssh() ");
2002 KOPrefs *p = KOPrefs::instance(); 2008 KOPrefs *p = KOPrefs::instance();
2003 QString localFile = p->mLocalTempFile; 2009 QString localFile = p->mLocalTempFile;
2004 QString remoteIP = p->mRemoteIP; 2010 QString remoteIP = p->mRemoteIP;
2005 QString remoteUser = p->mRemoteUser; 2011 QString remoteUser = p->mRemoteUser;
2006 QString remoteFile = p->mRemoteFile; 2012 QString remoteFile = p->mRemoteFile;
2007 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) 2013 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 )
2008 remoteUser += ":" + p->mRemotePassWd; 2014 remoteUser += ":" + p->mRemotePassWd;
2009 2015
2010 QString question = i18n("Do you really want\nto remote sync?\n \n") + 2016 QString question = i18n("Do you really want\nto remote sync?\n \n") +
2011 i18n("IP: " ) +remoteIP +"\n" + 2017 i18n("IP: " ) +remoteIP +"\n" +
2012 i18n("User: " ) + remoteUser +"\n" ; 2018 i18n("User: " ) + remoteUser +"\n" ;
2013 int maxlen = 30; 2019 int maxlen = 30;
2014 if ( QApplication::desktop()->width() > 320 ) 2020 if ( QApplication::desktop()->width() > 320 )
2015 maxlen += 25; 2021 maxlen += 25;
2016 if ( remoteFile.length() > maxlen ) 2022 if ( remoteFile.length() > maxlen )
2017 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; 2023 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n";
2018 else 2024 else
2019 question += i18n("Remote file:\n " ) + remoteFile +"\n"; 2025 question += i18n("Remote file:\n " ) + remoteFile +"\n";
2020 if ( localFile.length() > maxlen ) 2026 if ( localFile.length() > maxlen )
2021 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; 2027 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n";
2022 else 2028 else
2023 question += i18n("Local temp file:\n " ) + localFile +"\n"; 2029 question += i18n("Local temp file:\n " ) + localFile +"\n";
2024 2030
2025 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2031 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2026 question, 2032 question,
2027 i18n("Yes"), i18n("No"), 2033 i18n("Yes"), i18n("No"),
2028 0, 0 ) != 0 ) 2034 0, 0 ) != 0 )
2029 return; 2035 return;
2030 // if ( !p->mUsePassWd ) { 2036 // if ( !p->mUsePassWd ) {
2031 // QString pass = getPassword(); 2037 // QString pass = getPassword();
2032 // if ( pass.length() > 0 ) 2038 // if ( pass.length() > 0 )
2033 // remoteUser += ":" + pass; 2039 // remoteUser += ":" + pass;
2034 // } 2040 // }
2035 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; 2041 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile;
2036 setCaption ( i18n( "Copy remote file to local machine..." ) ); 2042 setCaption ( i18n( "Copy remote file to local machine..." ) );
2037 int fileSize = 0; 2043 int fileSize = 0;
2038 int result = system ( command ); 2044 int result = system ( command );
2039 // 0 : okay 2045 // 0 : okay
2040 // 256: no such file or dir 2046 // 256: no such file or dir
2041 // 2047 //
2042 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 2048 qDebug("KO: Remote copy result(0 = okay): %d ",result );
2043 if ( result != 0 ) { 2049 if ( result != 0 ) {
2044 int len = maxlen; 2050 int len = maxlen;
2045 while ( len < command.length() ) { 2051 while ( len < command.length() ) {
2046 command.insert( len , "\n" ); 2052 command.insert( len , "\n" );
2047 len += maxlen +2; 2053 len += maxlen +2;
2048 } 2054 }
2049 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 2055 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
2050 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2056 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2051 question, 2057 question,
2052 i18n("Okay!")) ; 2058 i18n("Okay!")) ;
2053 setCaption ("KO/Pi"); 2059 setCaption ("KO/Pi");
2054 return; 2060 return;
2055 } 2061 }
2056 2062
2057 2063
2058 setCaption ( i18n( "Copying succeed." ) ); 2064 setCaption ( i18n( "Copying succeed." ) );
2059 //mView->setSyncDevice("ssh-scp" ); 2065 //mView->setSyncDevice("ssh-scp" );
2060 if ( syncWithFile(localFile , true ) ) { 2066 if ( syncWithFile(localFile , true ) ) {
2061// Event* e = mView->getLastSyncEvent(); 2067// Event* e = mView->getLastSyncEvent();
2062// e->setReadOnly( false ); 2068// e->setReadOnly( false );
2063// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2069// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2064// e->setReadOnly( true ); 2070// e->setReadOnly( true );
2065 if ( KOPrefs::instance()->mWriteBackFile ) { 2071 if ( KOPrefs::instance()->mWriteBackFile ) {
2066 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; 2072 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ;
2067 setCaption ( i18n( "Writing back file ..." ) ); 2073 setCaption ( i18n( "Writing back file ..." ) );
2068 result = system ( command ); 2074 result = system ( command );
2069 if ( result != 0 ) { 2075 if ( result != 0 ) {
2070 int len = maxlen; 2076 int len = maxlen;
2071 while ( len < command.length() ) { 2077 while ( len < command.length() ) {
2072 command.insert( len , "\n" ); 2078 command.insert( len , "\n" );
2073 len += maxlen +2; 2079 len += maxlen +2;
2074 } 2080 }
2075 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 2081 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
2076 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2082 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2077 question, 2083 question,
2078 i18n("Okay!")) ; 2084 i18n("Okay!")) ;
2079 setCaption ("KO/Pi"); 2085 setCaption ("KO/Pi");
2080 return; 2086 return;
2081 } else { 2087 } else {
2082 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 2088 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2083 } 2089 }
2084 } 2090 }
2085 } 2091 }
2086 return; 2092 return;
2087#if 0 2093#if 0
2088 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); 2094 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
2089 while ( timer.elapsed() < 5000 ) 2095 while ( timer.elapsed() < 5000 )
2090 qApp->processEvents(); 2096 qApp->processEvents();
2091 2097
2092 qDebug("MainWindow::merging) "); 2098 qDebug("MainWindow::merging) ");
2093 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); 2099 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
2094 while ( mBlockSaveFlag ) 2100 while ( mBlockSaveFlag )
2095 qApp->processEvents(); 2101 qApp->processEvents();
2096 save(); 2102 save();
2097 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); 2103 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
2098#endif 2104#endif
2099 2105
2100} 2106}
2101 2107
2102 2108
2103void MainWindow::syncSharp() 2109void MainWindow::syncSharp()
2104{ 2110{
2105 if ( mCalendarModifiedFlag ) 2111 if ( mCalendarModifiedFlag )
2106 save(); 2112 save();
2107 mView->syncSharp(); 2113 mView->syncSharp();
2108 slotModifiedChanged( true ); 2114 slotModifiedChanged( true );
2109 2115
2110} 2116}
2111void MainWindow::syncPhone() 2117void MainWindow::syncPhone()
2112{ 2118{
2113 if ( mCalendarModifiedFlag ) 2119 if ( mCalendarModifiedFlag )
2114 save(); 2120 save();
2115 mView->syncPhone(); 2121 mView->syncPhone();
2116 slotModifiedChanged( true ); 2122 slotModifiedChanged( true );
2117 2123
2118} 2124}
2119 2125
2120void MainWindow::printSel( ) 2126void MainWindow::printSel( )
2121{ 2127{
2122 mView->viewManager()->agendaView()->agenda()->printSelection(); 2128 mView->viewManager()->agendaView()->agenda()->printSelection();
2123} 2129}
2124 2130
2125void MainWindow::printCal() 2131void MainWindow::printCal()
2126{ 2132{
2127 mView->print();//mCp->showDialog(); 2133 mView->print();//mCp->showDialog();
2128} 2134}