summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (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
@@ -1890,192 +1890,193 @@ void MainWindow::saveOnClose()
1890 if ( p->mToolBarHor ) 1890 if ( p->mToolBarHor )
1891 p->mToolBarUp = iconToolBar->y() > height()/2; 1891 p->mToolBarUp = iconToolBar->y() > height()/2;
1892 else 1892 else
1893 p->mToolBarUp = iconToolBar->x() > width()/2; 1893 p->mToolBarUp = iconToolBar->x() > width()/2;
1894 if ( p->mToolBarHorV ) 1894 if ( p->mToolBarHorV )
1895 p->mToolBarUpV = viewToolBar->y() > height()/2; 1895 p->mToolBarUpV = viewToolBar->y() > height()/2;
1896 else 1896 else
1897 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1897 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1898 1898
1899 if ( p->mToolBarHorN ) 1899 if ( p->mToolBarHorN )
1900 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1900 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1901 else 1901 else
1902 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1902 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1903 if ( filterToolBar ) { 1903 if ( filterToolBar ) {
1904 if ( p->mToolBarHorF ) 1904 if ( p->mToolBarHorF )
1905 p->mToolBarUpF = filterToolBar->y() > height()/2; 1905 p->mToolBarUpF = filterToolBar->y() > height()/2;
1906 else 1906 else
1907 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1907 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1908 } 1908 }
1909#endif 1909#endif
1910 save(); 1910 save();
1911 mView->writeSettings(); 1911 mView->writeSettings();
1912 mView->checkSuspendAlarm(); 1912 mView->checkSuspendAlarm();
1913} 1913}
1914void MainWindow::slotModifiedChanged( bool ) 1914void MainWindow::slotModifiedChanged( bool )
1915{ 1915{
1916 if ( mBlockAtStartup ) 1916 if ( mBlockAtStartup )
1917 return; 1917 return;
1918 1918
1919 int msec; 1919 int msec;
1920 if ( mCalendarModifiedFlag ) { 1920 if ( mCalendarModifiedFlag ) {
1921 //qDebug(" MainWindow timer is running "); 1921 //qDebug(" MainWindow timer is running ");
1922 return; 1922 return;
1923 } 1923 }
1924 // we store the changes after 1 minute, 1924 // we store the changes after 1 minute,
1925 // and for safety reasons after 10 minutes again 1925 // and for safety reasons after 10 minutes again
1926 if ( !mSyncManager->blockSave() ) 1926 if ( !mSyncManager->blockSave() )
1927 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1927 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1928 else 1928 else
1929 msec = 1000 * 600; 1929 msec = 1000 * 600;
1930 mSaveTimer.start( msec, true ); // 1 minute 1930 mSaveTimer.start( msec, true ); // 1 minute
1931 qDebug("KO: Saving File in %d secs!", msec/1000); 1931 qDebug("KO: Saving File in %d secs!", msec/1000);
1932 mCalendarModifiedFlag = true; 1932 mCalendarModifiedFlag = true;
1933} 1933}
1934void MainWindow::saveStopTimer() 1934void MainWindow::saveStopTimer()
1935{ 1935{
1936 mSaveTimer.stop(); 1936 mSaveTimer.stop();
1937} 1937}
1938void MainWindow::backupAllFiles() 1938void MainWindow::backupAllFiles()
1939{ 1939{
1940 QDate reference ( 2000,1,1); 1940 QDate reference ( 2000,1,1);
1941 int daysTo = reference.daysTo ( QDate::currentDate() ); 1941 int daysTo = reference.daysTo ( QDate::currentDate() );
1942 setCaption(i18n("Creating backup ... please wait ..." )); 1942 setCaption(i18n("Creating backup ... please wait ..." ));
1943 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1943 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1944 // we need the file path, the backup dir and the number of bups as param 1944 // we need the file path, the backup dir and the number of bups as param
1945 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1945 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1946 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1946 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1947 bupDir = KGlobalSettings::backupDataDir(); 1947 bupDir = KGlobalSettings::backupDataDir();
1948 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1948 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1949 if ( retval == 0 ) { 1949 if ( retval == 0 ) {
1950 setCaption(i18n("Backup cancelled" )); 1950 setCaption(i18n("Backup cancelled" ));
1951 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1951 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1952 // retval == 0 : backup skipped for today, try again tomorrow 1952 // retval == 0 : backup skipped for today, try again tomorrow
1953 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1953 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
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 );
2018} 2019}
2019 2020
2020void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2021void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2021{ 2022{
2022 if ( !e->isAutoRepeat() ) { 2023 if ( !e->isAutoRepeat() ) {
2023 mFlagKeyPressed = false; 2024 mFlagKeyPressed = false;
2024 } 2025 }
2025} 2026}
2026void MainWindow::keyPressEvent ( QKeyEvent * e ) 2027void MainWindow::keyPressEvent ( QKeyEvent * e )
2027{ 2028{
2028 qApp->processEvents(); 2029 qApp->processEvents();
2029 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2030 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2030 e->ignore(); 2031 e->ignore();
2031 // qDebug(" ignore %d",e->isAutoRepeat() ); 2032 // qDebug(" ignore %d",e->isAutoRepeat() );
2032 return; 2033 return;
2033 } 2034 }
2034 if (! e->isAutoRepeat() ) 2035 if (! e->isAutoRepeat() )
2035 mFlagKeyPressed = true; 2036 mFlagKeyPressed = true;
2036 KOPrefs *p = KOPrefs::instance(); 2037 KOPrefs *p = KOPrefs::instance();
2037 bool showSelectedDates = false; 2038 bool showSelectedDates = false;
2038 int size; 2039 int size;
2039 int pro = 0; 2040 int pro = 0;
2040 //qDebug("MainWindow::keyPressEvent "); 2041 //qDebug("MainWindow::keyPressEvent ");
2041 switch ( e->key() ) { 2042 switch ( e->key() ) {
2042 case Qt::Key_Right: 2043 case Qt::Key_Right:
2043 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2044 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2044 mView->goNextMonth(); 2045 mView->goNextMonth();
2045 else 2046 else
2046 mView->goNext(); 2047 mView->goNext();
2047 showSelectedDates = true; 2048 showSelectedDates = true;
2048 break; 2049 break;
2049 case Qt::Key_Left: 2050 case Qt::Key_Left:
2050 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2051 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2051 mView->goPreviousMonth(); 2052 mView->goPreviousMonth();
2052 else 2053 else
2053 mView->goPrevious(); 2054 mView->goPrevious();
2054 showSelectedDates = true; 2055 showSelectedDates = true;
2055 break; 2056 break;
2056 case Qt::Key_Down: 2057 case Qt::Key_Down:
2057 mView->viewManager()->agendaView()->scrollOneHourDown(); 2058 mView->viewManager()->agendaView()->scrollOneHourDown();
2058 break; 2059 break;
2059 case Qt::Key_Up: 2060 case Qt::Key_Up:
2060 mView->viewManager()->agendaView()->scrollOneHourUp(); 2061 mView->viewManager()->agendaView()->scrollOneHourUp();
2061 break; 2062 break;
2062 case Qt::Key_K: 2063 case Qt::Key_K:
2063 mView->viewManager()->showMonthViewWeek(); 2064 mView->viewManager()->showMonthViewWeek();
2064 break; 2065 break;
2065 case Qt::Key_I: 2066 case Qt::Key_I:
2066 mView->showIncidence(); 2067 mView->showIncidence();
2067 break; 2068 break;
2068 case Qt::Key_Delete: 2069 case Qt::Key_Delete:
2069 case Qt::Key_Backspace: 2070 case Qt::Key_Backspace:
2070 mView->deleteIncidence(); 2071 mView->deleteIncidence();
2071 break; 2072 break;
2072 case Qt::Key_D: 2073 case Qt::Key_D:
2073 mView->viewManager()->showDayView(); 2074 mView->viewManager()->showDayView();
2074 showSelectedDates = true; 2075 showSelectedDates = true;
2075 break; 2076 break;
2076 case Qt::Key_O: 2077 case Qt::Key_O:
2077 mView->toggleFilerEnabled( ); 2078 mView->toggleFilerEnabled( );
2078 break; 2079 break;
2079 case Qt::Key_0: 2080 case Qt::Key_0:
2080 case Qt::Key_1: 2081 case Qt::Key_1:
2081 case Qt::Key_2: 2082 case Qt::Key_2:
@@ -2466,199 +2467,205 @@ void MainWindow::loadCalendar()
2466 if ( loadbup ) { 2467 if ( loadbup ) {
2467 mView->openCalendar( fn ); 2468 mView->openCalendar( fn );
2468 KOPrefs::instance()->mLastLoadFile = fn; 2469 KOPrefs::instance()->mLastLoadFile = fn;
2469 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2470 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2470 setCaption(mess); 2471 setCaption(mess);
2471 } 2472 }
2472#endif 2473#endif
2473 2474
2474} 2475}
2475void MainWindow::quickImportIcal() 2476void MainWindow::quickImportIcal()
2476{ 2477{
2477 importFile( KOPrefs::instance()->mLastImportFile, false ); 2478 importFile( KOPrefs::instance()->mLastImportFile, false );
2478} 2479}
2479void MainWindow::importFile( QString fn, bool quick ) 2480void MainWindow::importFile( QString fn, bool quick )
2480{ 2481{
2481 QFileInfo info; 2482 QFileInfo info;
2482 info.setFile( fn ); 2483 info.setFile( fn );
2483 QString mess; 2484 QString mess;
2484 if ( !info. exists() ) { 2485 if ( !info. exists() ) {
2485 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2486 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2486 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2487 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2487 mess ); 2488 mess );
2488 return; 2489 return;
2489 } 2490 }
2490 int result = 0; 2491 int result = 0;
2491 if ( !quick ) { 2492 if ( !quick ) {
2492 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 )); 2493 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 ));
2493 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2494 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2494 mess, 2495 mess,
2495 "Import", "Cancel", 0, 2496 "Import", "Cancel", 0,
2496 0, 1 ); 2497 0, 1 );
2497 } 2498 }
2498 if ( result == 0 ) { 2499 if ( result == 0 ) {
2499 if ( mView->openCalendar( fn, true )) { 2500 if ( mView->openCalendar( fn, true )) {
2500 KOPrefs::instance()->mLastImportFile = fn; 2501 KOPrefs::instance()->mLastImportFile = fn;
2501 setCaption(i18n("Imported file successfully")); 2502 setCaption(i18n("Imported file successfully"));
2502 } else { 2503 } else {
2503 setCaption(i18n("Error importing file")); 2504 setCaption(i18n("Error importing file"));
2504 } 2505 }
2505 } 2506 }
2506} 2507}
2507 2508
2508void MainWindow::importIcal() 2509void MainWindow::importIcal()
2509{ 2510{
2510 2511
2511 QString fn =KOPrefs::instance()->mLastImportFile; 2512 QString fn =KOPrefs::instance()->mLastImportFile;
2512 2513
2513 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2514 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2514 if ( fn == "" ) 2515 if ( fn == "" )
2515 return; 2516 return;
2516 importFile( fn, true ); 2517 importFile( fn, true );
2517 2518
2518} 2519}
2519 2520
2520void MainWindow::exportVCalendar() 2521void MainWindow::exportVCalendar()
2521{ 2522{
2522 QString fn = KOPrefs::instance()->mLastVcalFile; 2523 QString fn = KOPrefs::instance()->mLastVcalFile;
2523 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2524 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2524 if ( fn == "" ) 2525 if ( fn == "" )
2525 return; 2526 return;
2526 QFileInfo info; 2527 QFileInfo info;
2527 info.setFile( fn ); 2528 info.setFile( fn );
2528 QString mes; 2529 QString mes;
2529 bool createbup = true; 2530 bool createbup = true;
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
2601#include "libkdepim/kdatepicker.h" 2608#include "libkdepim/kdatepicker.h"
2602#include <kdatetbl.h> 2609#include <kdatetbl.h>
2603 2610
2604void MainWindow::weekAction() 2611void MainWindow::weekAction()
2605{ 2612{
2606 int month; 2613 int month;
2607 KPopupFrame* popup = new KPopupFrame(this); 2614 KPopupFrame* popup = new KPopupFrame(this);
2608 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2615 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2609 // ----- 2616 // -----
2610 picker->resize(picker->sizeHint()); 2617 picker->resize(picker->sizeHint());
2611 popup->setMainWidget(picker); 2618 popup->setMainWidget(picker);
2612 picker->setFocus(); 2619 picker->setFocus();
2613 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2620 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2614 int x = 0; 2621 int x = 0;
2615 int y = iconToolBar->height(); 2622 int y = iconToolBar->height();
2616 int dX = 0; 2623 int dX = 0;
2617 int dY = 0; 2624 int dY = 0;
2618 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2625 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2619 if ( iconToolBar->y() > height()/2 ) { 2626 if ( iconToolBar->y() > height()/2 ) {
2620 dY = picker->sizeHint().height()+8; 2627 dY = picker->sizeHint().height()+8;
2621 y = 0; 2628 y = 0;
2622 } 2629 }
2623 } else { 2630 } else {
2624 if ( iconToolBar->x() > width()/2 ) { // right side 2631 if ( iconToolBar->x() > width()/2 ) { // right side
2625 x=0; 2632 x=0;
2626 dX= picker->sizeHint().width()+8; 2633 dX= picker->sizeHint().width()+8;
2627 y = 0; 2634 y = 0;
2628 } else { 2635 } else {
2629 x= iconToolBar->width(); 2636 x= iconToolBar->width();
2630 y = 0; 2637 y = 0;
2631 } 2638 }
2632 } 2639 }
2633 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2640 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2634 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2641 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2635 { 2642 {
2636 month = picker->getResult(); 2643 month = picker->getResult();
2637 emit selectWeek ( month ); 2644 emit selectWeek ( month );
2638 //qDebug("weekSelected %d ", month); 2645 //qDebug("weekSelected %d ", month);
2639 } 2646 }
2640 delete popup; 2647 delete popup;
2641} 2648}
2642 2649
2643void MainWindow::hideEvent ( QHideEvent * ) 2650void MainWindow::hideEvent ( QHideEvent * )
2644{ 2651{
2645 QString message; 2652 QString message;
2646 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2653 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2647 if ( nextA.isValid() ) { 2654 if ( nextA.isValid() ) {
2648 QString sum = mCalendar->nextSummary(); 2655 QString sum = mCalendar->nextSummary();
2649 2656
2650 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2657 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2651 setCaption( message ); 2658 setCaption( message );
2652 } 2659 }
2653} 2660}
2654 2661
2655void MainWindow::resizeEvent( QResizeEvent* e) 2662void MainWindow::resizeEvent( QResizeEvent* e)
2656{ 2663{
2657#ifndef DESKTOP_VERSION 2664#ifndef DESKTOP_VERSION
2658 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2665 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2659 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2666 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2660 filterToolBar->hide(); 2667 filterToolBar->hide();
2661 else 2668 else
2662 filterToolBar->show(); 2669 filterToolBar->show();
2663 } 2670 }
2664#endif 2671#endif