summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp75
1 files changed, 59 insertions, 16 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c597138..66bb19b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -149,48 +149,49 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mAutoSaveDisabled = false;
173 mClosed = false; 174 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 175 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 176 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 177 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 178 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 179 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 180 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 181 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 182 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 183 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 184 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 185 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 186 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 187 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 188 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 189 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 190 if ( p->mToolBarUp )
190 tbd = Bottom; 191 tbd = Bottom;
191 else 192 else
192 tbd = Top; 193 tbd = Top;
193 } 194 }
194 else { 195 else {
195 if ( p->mToolBarUp ) 196 if ( p->mToolBarUp )
196 tbd = Right; 197 tbd = Right;
@@ -516,75 +517,93 @@ void MainWindow::showMaximized ()
516 if ( mClosed ) 517 if ( mClosed )
517 mView->goToday(); 518 mView->goToday();
518#endif 519#endif
519 QWidget::showMaximized () ; 520 QWidget::showMaximized () ;
520 mClosed = false; 521 mClosed = false;
521} 522}
522 523
523bool MainWindow::askForQuitOnSaveError() 524bool MainWindow::askForQuitOnSaveError()
524{ 525{
525 bool retval = false; 526 bool retval = false;
526 switch( QMessageBox::information( this, "KO/Pi", 527 switch( QMessageBox::information( this, "KO/Pi",
527 i18n("Error saving data") + "!\n" + 528 i18n("Error saving data") + "!\n" +
528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 529 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
529 i18n("Do you really want\nto close KO/Pi?"), 530 i18n("Do you really want\nto close KO/Pi?"),
530 i18n(" Yes, close "), i18n("No"), 531 i18n(" Yes, close "), i18n("No"),
531 0, 1 ) ) { 532 0, 1 ) ) {
532 case 0: 533 case 0:
533 retval = true; 534 retval = true;
534 break; 535 break;
535 default: 536 default:
536 break; 537 break;
537 } 538 }
538 return retval; 539 return retval;
539} 540}
540 541bool MainWindow::checkAutosave()
542{
543 bool savedata = true;
544 if ( mAutoSaveDisabled && mCalendarModifiedFlag ) {
545 switch( QMessageBox::information( this, "KO/Pi",
546 i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"),
547 i18n("Yes, Save!"), i18n("No"),
548 0, 0 ) ) {
549 case 1:
550 case 2:
551 savedata = false;
552 break;
553 default:
554 break;
555 }
556 }
557 return savedata;
558}
541void MainWindow::closeEvent( QCloseEvent* ce ) 559void MainWindow::closeEvent( QCloseEvent* ce )
542{ 560{
543
544
545
546 if ( ! KOPrefs::instance()->mAskForQuit ) { 561 if ( ! KOPrefs::instance()->mAskForQuit ) {
547 saveOnClose(); 562 if ( checkAutosave() ) {
548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 563 saveOnClose();
549 ce->ignore(); 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
550 return; 565 ce->ignore();
566 return;
567 }
551 } 568 }
552 mClosed = true; 569 mClosed = true;
553 ce->accept(); 570 ce->accept();
554 return; 571 return;
555 572
556 } 573 }
557 574
558 switch( QMessageBox::information( this, "KO/Pi", 575 switch( QMessageBox::information( this, "KO/Pi",
559 i18n("Do you really want\nto close KO/Pi?"), 576 i18n("Do you really want\nto close KO/Pi?"),
560 i18n("Close"), i18n("No"), 577 i18n("Close"), i18n("No"),
561 0, 0 ) ) { 578 0, 0 ) ) {
562 case 0: 579 case 0:
563 saveOnClose(); 580 if ( checkAutosave() ) {
564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 581 saveOnClose();
565 ce->ignore(); 582 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
566 return; 583 ce->ignore();
584 return;
585 }
567 } 586 }
568 mClosed = true; 587 mClosed = true;
569 ce->accept(); 588 ce->accept();
570 break; 589 break;
571 case 1: 590 case 1:
572 ce->ignore(); 591 ce->ignore();
573 break; 592 break;
574 case 2: 593 case 2:
575 594
576 default: 595 default:
577 break; 596 break;
578 } 597 }
579 598
580 599
581} 600}
582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 601void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
583{ 602{
584 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 603 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
585 mCStringMess = cmsg; 604 mCStringMess = cmsg;
586 mByteData = data; 605 mByteData = data;
587} 606}
588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 607void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
589{ 608{
590 QDataStream stream( data, IO_ReadOnly ); 609 QDataStream stream( data, IO_ReadOnly );
@@ -1636,48 +1655,49 @@ void MainWindow::licence()
1636 1655
1637} 1656}
1638void MainWindow::about() 1657void MainWindow::about()
1639{ 1658{
1640 QString version; 1659 QString version;
1641#include <../version> 1660#include <../version>
1642 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1661 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1643 i18n("KOrganizer/Platform-independent\n") + 1662 i18n("KOrganizer/Platform-independent\n") +
1644 "(KO/Pi) " + version + " - " + 1663 "(KO/Pi) " + version + " - " +
1645 1664
1646#ifdef DESKTOP_VERSION 1665#ifdef DESKTOP_VERSION
1647 i18n("Desktop Edition\n") + 1666 i18n("Desktop Edition\n") +
1648#else 1667#else
1649 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1668 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1650#endif 1669#endif
1651 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1670 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1652} 1671}
1653void MainWindow::keyBindings() 1672void MainWindow::keyBindings()
1654{ 1673{
1655 QString cap = i18n("KO/Pi Keys + Colors"); 1674 QString cap = i18n("KO/Pi Keys + Colors");
1656 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1675 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1657 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1676 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1658 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1677 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1659 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1678 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1679 i18n("<p><b>C+ctrl</b>: Dis/enable automatic saving</p>\n") +
1660 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1680 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1661 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1681 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1662 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1682 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1663 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1683 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1664 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1684 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1665 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1685 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1666 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ 1686 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
1667 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1687 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1668 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1688 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1669 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1689 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1670 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1690 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1671 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1691 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1672 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1692 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1673 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1693 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1674 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1694 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1675 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1695 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1676 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1696 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1677 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1697 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1678 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1698 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1679 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1699 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1680 i18n("<p><h3>In agenda view:</h3></p>\n") + 1700 i18n("<p><h3>In agenda view:</h3></p>\n") +
1681 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1701 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1682 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1702 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1683 i18n("<p><h3>In todo view:</h3></p>\n") + 1703 i18n("<p><h3>In todo view:</h3></p>\n") +
@@ -1951,67 +1971,79 @@ void MainWindow::saveOnClose()
1951 else 1971 else
1952 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1972 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1953 1973
1954 if ( p->mToolBarHorN ) 1974 if ( p->mToolBarHorN )
1955 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1975 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1956 else 1976 else
1957 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1977 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1958 if ( filterToolBar ) { 1978 if ( filterToolBar ) {
1959 if ( p->mToolBarHorF ) 1979 if ( p->mToolBarHorF )
1960 p->mToolBarUpF = filterToolBar->y() > height()/2; 1980 p->mToolBarUpF = filterToolBar->y() > height()/2;
1961 else 1981 else
1962 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1982 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1963 } 1983 }
1964#endif 1984#endif
1965 save(); 1985 save();
1966 mView->writeSettings(); 1986 mView->writeSettings();
1967 mView->checkSuspendAlarm(); 1987 mView->checkSuspendAlarm();
1968} 1988}
1969void MainWindow::slotModifiedChanged( bool ) 1989void MainWindow::slotModifiedChanged( bool )
1970{ 1990{
1971 if ( mBlockAtStartup ) 1991 if ( mBlockAtStartup )
1972 return; 1992 return;
1973 1993
1974 int msec; 1994 int msec;
1995 if ( mAutoSaveDisabled ) {
1996 QTimer::singleShot( 0, this , SLOT ( autoSaveWarning() ) );
1997 qDebug("KO: Autosave disabled (data change deteced)!");
1998 }
1975 if ( mCalendarModifiedFlag ) { 1999 if ( mCalendarModifiedFlag ) {
1976 //qDebug(" MainWindow timer is running "); 2000 //qDebug(" MainWindow timer is running ");
1977 return; 2001 return;
1978 } 2002 }
2003 mCalendarModifiedFlag = true;
2004 if ( mAutoSaveDisabled ) {
2005 return;
2006 }
1979 // we store the changes after 1 minute, 2007 // we store the changes after 1 minute,
1980 // and for safety reasons after 10 minutes again 2008 // and for safety reasons after 10 minutes again
1981 if ( !mSyncManager->blockSave() ) 2009 if ( !mSyncManager->blockSave() )
1982 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 2010 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1983 else 2011 else
1984 msec = 1000 * 600; 2012 msec = 1000 * 600;
1985 mSaveTimer.start( msec, true ); // 1 minute 2013 mSaveTimer.start( msec, true ); // 1 minute
1986 mSaveTimerStart = QDateTime::currentDateTime(); 2014 mSaveTimerStart = QDateTime::currentDateTime();
1987 mSaveDelay = msec/1000; 2015 mSaveDelay = msec/1000;
1988 qDebug("KO: Saving File in %d secs!", msec/1000); 2016 qDebug("KO: Saving File in %d secs!", msec/1000);
1989 mCalendarModifiedFlag = true; 2017}
2018void MainWindow::autoSaveWarning()
2019{
2020 setCaption(i18n("Autosave disabled!" ));
1990} 2021}
1991void MainWindow::saveStopTimer() 2022void MainWindow::saveStopTimer()
1992{ 2023{
1993 mSaveTimer.stop(); 2024 mSaveTimer.stop();
2025 mSaveDelay = 0;
1994} 2026}
1995void MainWindow::backupAllFiles() 2027void MainWindow::backupAllFiles()
1996{ 2028{
1997 QDate reference ( 2000,1,1); 2029 QDate reference ( 2000,1,1);
1998 int daysTo = reference.daysTo ( QDate::currentDate() ); 2030 int daysTo = reference.daysTo ( QDate::currentDate() );
1999 setCaption(i18n("Creating backup ... please wait ..." )); 2031 setCaption(i18n("Creating backup ... please wait ..." ));
2000 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 2032 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
2001 // we need the file path, the backup dir and the number of bups as param 2033 // we need the file path, the backup dir and the number of bups as param
2002 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2034 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2003 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2035 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2004 bupDir = KGlobalSettings::backupDataDir(); 2036 bupDir = KGlobalSettings::backupDataDir();
2005 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2037 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2006 if ( retval == 0 ) { 2038 if ( retval == 0 ) {
2007 setCaption(i18n("Backup cancelled" )); 2039 setCaption(i18n("Backup cancelled" ));
2008 qDebug("KO: Backup cancelled. Will try again tomorrow "); 2040 qDebug("KO: Backup cancelled. Will try again tomorrow ");
2009 // retval == 0 : backup skipped for today, try again tomorrow 2041 // retval == 0 : backup skipped for today, try again tomorrow
2010 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 2042 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
2011 } else if ( retval == 1 ){ 2043 } else if ( retval == 1 ){
2012 qDebug("KO: Backup created."); 2044 qDebug("KO: Backup created.");
2013 // backup ok 2045 // backup ok
2014 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2046 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2015 KopiCalendarFile * cal = calendars.first(); 2047 KopiCalendarFile * cal = calendars.first();
2016 cal = calendars.next(); 2048 cal = calendars.next();
2017 while ( cal ) { 2049 while ( cal ) {
@@ -2186,50 +2218,61 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
2186 case Qt::Key_Y : 2218 case Qt::Key_Y :
2187 case Qt::Key_Z : 2219 case Qt::Key_Z :
2188 mView->viewManager()->showWorkWeekView(); 2220 mView->viewManager()->showWorkWeekView();
2189 showSelectedDates = true; 2221 showSelectedDates = true;
2190 break; 2222 break;
2191 case Qt::Key_U : 2223 case Qt::Key_U :
2192 mView->viewManager()->showWeekView(); 2224 mView->viewManager()->showWeekView();
2193 showSelectedDates = true; 2225 showSelectedDates = true;
2194 break; 2226 break;
2195 case Qt::Key_H : 2227 case Qt::Key_H :
2196 keyBindings(); 2228 keyBindings();
2197 break; 2229 break;
2198 case Qt::Key_W: 2230 case Qt::Key_W:
2199 mView->viewManager()->showWhatsNextView(); 2231 mView->viewManager()->showWhatsNextView();
2200 break; 2232 break;
2201 case Qt::Key_L: 2233 case Qt::Key_L:
2202 mView->viewManager()->showListView(); 2234 mView->viewManager()->showListView();
2203 break; 2235 break;
2204 case Qt::Key_N: 2236 case Qt::Key_N:
2205 mView->viewManager()->showNextView(); 2237 mView->viewManager()->showNextView();
2206 break; 2238 break;
2207 case Qt::Key_V: 2239 case Qt::Key_V:
2208 mView->viewManager()->showTodoView(); 2240 mView->viewManager()->showTodoView();
2209 break; 2241 break;
2210 case Qt::Key_C: 2242 case Qt::Key_C:
2211 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2243 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) {
2244 if ( mAutoSaveDisabled ) {
2245 mAutoSaveDisabled = false;
2246 setCaption(i18n("Autosave enabled!" ));
2247 return;
2248 } else {
2249 mAutoSaveDisabled = true;
2250 saveStopTimer();
2251 setCaption(i18n("Autosave disabled! Save timer stopped!" ));
2252 }
2253 } else
2254 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2212 break; 2255 break;
2213 case Qt::Key_P: 2256 case Qt::Key_P:
2214 mView->showDatePicker( ); 2257 mView->showDatePicker( );
2215 break; 2258 break;
2216 case Qt::Key_F: 2259 case Qt::Key_F:
2217 mView->editFilters(); 2260 mView->editFilters();
2218 break; 2261 break;
2219 case Qt::Key_R: 2262 case Qt::Key_R:
2220 mView->toggleFilter(); 2263 mView->toggleFilter();
2221 break; 2264 break;
2222 case Qt::Key_X: 2265 case Qt::Key_X:
2223 if ( e->state() == Qt::ControlButton ) 2266 if ( e->state() == Qt::ControlButton )
2224 mView->toggleDateNavigatorWidget(); 2267 mView->toggleDateNavigatorWidget();
2225 else { 2268 else {
2226 mView->viewManager()->showNextXView(); 2269 mView->viewManager()->showNextXView();
2227 showSelectedDates = true; 2270 showSelectedDates = true;
2228 } 2271 }
2229 break; 2272 break;
2230 case Qt::Key_Space: 2273 case Qt::Key_Space:
2231 mView->toggleExpand(); 2274 mView->toggleExpand();
2232 break; 2275 break;
2233 case Qt::Key_A: 2276 case Qt::Key_A:
2234 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2277 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2235 mView->showNextAlarms(); 2278 mView->showNextAlarms();