summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-29 21:08:59 (UTC)
committer zautrix <zautrix>2005-07-29 21:08:59 (UTC)
commit9cbd19485635dc0edacd14403e4c63d6d469bfce (patch) (unidiff)
treeb3d5a580428ac4ed0b0a7b92149438baf8a66846
parente287df45507793e2e5ad16085a858153f3798941 (diff)
downloadkdepimpi-9cbd19485635dc0edacd14403e4c63d6d469bfce.zip
kdepimpi-9cbd19485635dc0edacd14403e4c63d6d469bfce.tar.gz
kdepimpi-9cbd19485635dc0edacd14403e4c63d6d469bfce.tar.bz2
fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7ce0251..45775c5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1954,64 +1954,65 @@ void MainWindow::backupAllFiles()
1954 } else if ( retval == 1 ){ 1954 } else if ( retval == 1 ){
1955 qDebug("KO: Backup created."); 1955 qDebug("KO: Backup created.");
1956 // backup ok 1956 // backup ok
1957 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1957 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1958 KopiCalendarFile * cal = calendars.first(); 1958 KopiCalendarFile * cal = calendars.first();
1959 cal = calendars.next(); 1959 cal = calendars.next();
1960 while ( cal ) { 1960 while ( cal ) {
1961 if ( !cal->mErrorOnLoad ) { 1961 if ( !cal->mErrorOnLoad ) {
1962 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1962 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1963 } 1963 }
1964 cal = calendars.next(); 1964 cal = calendars.next();
1965 } 1965 }
1966 KOPrefs::instance()->mLastBackupDate = daysTo; 1966 KOPrefs::instance()->mLastBackupDate = daysTo;
1967 setCaption(i18n("Backup succesfully finished" )); 1967 setCaption(i18n("Backup succesfully finished" ));
1968 } else if ( retval == 2 ){ 1968 } else if ( retval == 2 ){
1969 setCaption(i18n("Backup globally disabled" )); 1969 setCaption(i18n("Backup globally disabled" ));
1970 qDebug("KO: Backup globally cancelled."); 1970 qDebug("KO: Backup globally cancelled.");
1971 // backup globally cancelled 1971 // backup globally cancelled
1972 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1972 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1973 } 1973 }
1974 // retval == 3: do nothing, try again later 1974 // retval == 3: do nothing, try again later
1975} 1975}
1976void MainWindow::save() 1976void MainWindow::save()
1977{ 1977{
1978 1978
1979 if ( mView->viewManager()->journalView() ) 1979 if ( mView->viewManager()->journalView() )
1980 mView->viewManager()->journalView()->checkModified(); 1980 mView->viewManager()->journalView()->checkModified();
1981 if ( !mCalendarModifiedFlag ) { 1981 if ( !mCalendarModifiedFlag ) {
1982 qDebug("KO: Calendar not modified. Nothing saved."); 1982 qDebug("KO: Calendar not modified. Nothing saved.");
1983 return; 1983 return;
1984 } 1984 }
1985 if ( mSyncManager->blockSave() ) { 1985 if ( mSyncManager->blockSave() ) {
1986 slotModifiedChanged( true );
1986 return; 1987 return;
1987 } 1988 }
1988 mSyncManager->setBlockSave(true); 1989 mSyncManager->setBlockSave(true);
1989 if ( mView->checkAllFileVersions() ) { 1990 if ( mView->checkAllFileVersions() ) {
1990 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1991 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1991 QDate reference ( 2000,1,1); 1992 QDate reference ( 2000,1,1);
1992 int daysTo = reference.daysTo ( QDate::currentDate() ); 1993 int daysTo = reference.daysTo ( QDate::currentDate() );
1993 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1994 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1994 backupAllFiles(); 1995 backupAllFiles();
1995 } 1996 }
1996 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1997 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1997 } 1998 }
1998 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1999 QTime neededSaveTime = QDateTime::currentDateTime().time();
1999 if ( !isMinimized () ) 2000 if ( !isMinimized () )
2000 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 2001 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
2001 qDebug("KO: Start saving data to file!"); 2002 qDebug("KO: Start saving data to file!");
2002 mView->saveCalendars(); 2003 mView->saveCalendars();
2003 mCalendarModifiedFlag = false; 2004 mCalendarModifiedFlag = false;
2004 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 2005 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
2005 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2006 qDebug("KO: Needed %d ms for saving.",msNeeded );
2006 QString savemes; 2007 QString savemes;
2007 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2008 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2008 if ( !isMinimized () ) 2009 if ( !isMinimized () )
2009 setCaption(savemes); 2010 setCaption(savemes);
2010 else 2011 else
2011 qDebug(savemes); 2012 qDebug(savemes);
2012 } else { 2013 } else {
2013 setCaption(i18n("Saving cancelled!")); 2014 setCaption(i18n("Saving cancelled!"));
2014 mCalendarModifiedFlag = false; 2015 mCalendarModifiedFlag = false;
2015 slotModifiedChanged( true ); 2016 slotModifiedChanged( true );
2016 } 2017 }
2017 mSyncManager->setBlockSave( false ); 2018 mSyncManager->setBlockSave( false );
@@ -2530,71 +2531,77 @@ void MainWindow::exportVCalendar()
2530 if ( info. exists() ) { 2531 if ( info. exists() ) {
2531 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2532 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2532 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2533 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2533 i18n("Overwrite!"), i18n("Cancel"), 0, 2534 i18n("Overwrite!"), i18n("Cancel"), 0,
2534 0, 1 ); 2535 0, 1 );
2535 if ( result != 0 ) { 2536 if ( result != 0 ) {
2536 createbup = false; 2537 createbup = false;
2537 } 2538 }
2538 } 2539 }
2539 if ( createbup ) { 2540 if ( createbup ) {
2540 if ( mView->exportVCalendar( fn ) ) { 2541 if ( mView->exportVCalendar( fn ) ) {
2541 KOPrefs::instance()->mLastVcalFile = fn; 2542 KOPrefs::instance()->mLastVcalFile = fn;
2542 if ( fn.length() > 20 ) 2543 if ( fn.length() > 20 )
2543 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2544 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2544 else 2545 else
2545 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2546 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2546 setCaption(mes); 2547 setCaption(mes);
2547 } 2548 }
2548 } 2549 }
2549 2550
2550} 2551}
2551QString MainWindow::sentSyncFile() 2552QString MainWindow::sentSyncFile()
2552{ 2553{
2553#ifdef DESKTOP_VERSION 2554#ifdef DESKTOP_VERSION
2554 return locateLocal( "tmp", "copysynccal.ics" ); 2555 return locateLocal( "tmp", "copysynccal.ics" );
2555#else 2556#else
2556 return QString( "/tmp/copysynccal.ics" ); 2557 return QString( "/tmp/copysynccal.ics" );
2557#endif 2558#endif
2558} 2559}
2559 2560
2560void MainWindow::syncFileRequest() 2561void MainWindow::syncFileRequest()
2561{ 2562{
2563 while ( mSyncManager->blockSave() ) {
2564 qApp->processEvents();
2565 }
2566 mSyncManager->setBlockSave(true);
2567
2562 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2568 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2563 mSyncManager->slotSyncMenu( 999 ); 2569 mSyncManager->slotSyncMenu( 999 );
2564 } 2570 }
2565 2571
2566 setCaption(i18n("Saving Data to temp file ..." )); 2572 setCaption(i18n("Saving Data to temp file ..." ));
2567 mView->saveCalendar( sentSyncFile() ); 2573 mView->saveCalendar( sentSyncFile() );
2568 setCaption(i18n("Data saved to temp file!" )); 2574 setCaption(i18n("Data saved to temp file!" ));
2575 mSyncManager->setBlockSave( false );
2569 2576
2570} 2577}
2571void MainWindow::getFile( bool success ) 2578void MainWindow::getFile( bool success )
2572{ 2579{
2573 if ( ! success ) { 2580 if ( ! success ) {
2574 setCaption( i18n("Error receiving file. Nothing changed!") ); 2581 setCaption( i18n("Error receiving file. Nothing changed!") );
2575 return; 2582 return;
2576 } 2583 }
2577 mView->mergeFile( sentSyncFile() ); 2584 mView->mergeFile( sentSyncFile() );
2578 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2585 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2579 mSyncManager->slotSyncMenu( 999 ); 2586 mSyncManager->slotSyncMenu( 999 );
2580 } 2587 }
2581 setCaption( i18n("Pi-Sync successful!") ); 2588 setCaption( i18n("Pi-Sync successful!") );
2582} 2589}
2583void MainWindow::printListView() 2590void MainWindow::printListView()
2584{ 2591{
2585 2592
2586 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2593 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2587 2594
2588 KMessageBox::information( this, message); 2595 KMessageBox::information( this, message);
2589} 2596}
2590void MainWindow::printSel( ) 2597void MainWindow::printSel( )
2591{ 2598{
2592 mView->viewManager()->agendaView()->agenda()->printSelection(); 2599 mView->viewManager()->agendaView()->agenda()->printSelection();
2593} 2600}
2594 2601
2595void MainWindow::printCal() 2602void MainWindow::printCal()
2596{ 2603{
2597 mView->print();//mCp->showDialog(); 2604 mView->print();//mCp->showDialog();
2598} 2605}
2599 2606
2600 2607