summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9505d06..94f4677 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1729,100 +1729,96 @@ void MainWindow::saveOnClose()
1729 p->mToolBarUpF = myP.x() > width()/2 ; 1729 p->mToolBarUpF = myP.x() > width()/2 ;
1730 } 1730 }
1731#else 1731#else
1732 if ( p->mToolBarHor ) 1732 if ( p->mToolBarHor )
1733 p->mToolBarUp = iconToolBar->y() > height()/2; 1733 p->mToolBarUp = iconToolBar->y() > height()/2;
1734 else 1734 else
1735 p->mToolBarUp = iconToolBar->x() > width()/2; 1735 p->mToolBarUp = iconToolBar->x() > width()/2;
1736 if ( p->mToolBarHorV ) 1736 if ( p->mToolBarHorV )
1737 p->mToolBarUpV = viewToolBar->y() > height()/2; 1737 p->mToolBarUpV = viewToolBar->y() > height()/2;
1738 else 1738 else
1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1740 1740
1741 if ( p->mToolBarHorN ) 1741 if ( p->mToolBarHorN )
1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1743 else 1743 else
1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1745 if ( filterToolBar ) { 1745 if ( filterToolBar ) {
1746 if ( p->mToolBarHorF ) 1746 if ( p->mToolBarHorF )
1747 p->mToolBarUpF = filterToolBar->y() > height()/2; 1747 p->mToolBarUpF = filterToolBar->y() > height()/2;
1748 else 1748 else
1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1750 } 1750 }
1751#endif 1751#endif
1752 1752
1753 1753
1754 mView->writeSettings(); 1754 mView->writeSettings();
1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1756 save(); 1756 save();
1757} 1757}
1758void MainWindow::slotModifiedChanged( bool changed ) 1758void MainWindow::slotModifiedChanged( bool changed )
1759{ 1759{
1760 if ( mBlockAtStartup ) 1760 if ( mBlockAtStartup )
1761 return; 1761 return;
1762 1762
1763 int msec; 1763 int msec;
1764 // we store the changes after 1 minute, 1764 // we store the changes after 1 minute,
1765 // and for safety reasons after 10 minutes again 1765 // and for safety reasons after 10 minutes again
1766 if ( !mSyncManager->blockSave() ) 1766 if ( !mSyncManager->blockSave() )
1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1768 else 1768 else
1769 msec = 1000 * 600; 1769 msec = 1000 * 600;
1770 mSaveTimer.start( msec, true ); // 1 minute 1770 mSaveTimer.start( msec, true ); // 1 minute
1771 qDebug("KO: Saving File in %d secs!", msec/1000); 1771 qDebug("KO: Saving File in %d secs!", msec/1000);
1772 mCalendarModifiedFlag = true; 1772 mCalendarModifiedFlag = true;
1773} 1773}
1774void MainWindow::saveStopTimer() 1774void MainWindow::saveStopTimer()
1775{ 1775{
1776 mSaveTimer.stop(); 1776 mSaveTimer.stop();
1777 if (mSaveTimer.isActive() )
1778 qDebug("ti active ");
1779 else
1780 qDebug("KO: Save timer stopped");
1781} 1777}
1782void MainWindow::save() 1778void MainWindow::save()
1783{ 1779{
1784 if ( !mCalendarModifiedFlag ) { 1780 if ( !mCalendarModifiedFlag ) {
1785 qDebug("KO: Calendar not modified. Nothing saved."); 1781 qDebug("KO: Calendar not modified. Nothing saved.");
1786 return; 1782 return;
1787 } 1783 }
1788 if ( mSyncManager->blockSave() ) 1784 if ( mSyncManager->blockSave() )
1789 return; 1785 return;
1790 mSyncManager->setBlockSave(true); 1786 mSyncManager->setBlockSave(true);
1791 if ( mView->checkFileVersion( defaultFileName()) ) { 1787 if ( mView->checkFileVersion( defaultFileName()) ) {
1792 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1788 QTime neededSaveTime = QDateTime::currentDateTime().time();
1793 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1789 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1794 qDebug("KO: Start saving data to file!"); 1790 qDebug("KO: Start saving data to file!");
1795 mView->saveCalendar( defaultFileName() ); 1791 mView->saveCalendar( defaultFileName() );
1796 mCalendarModifiedFlag = false; 1792 mCalendarModifiedFlag = false;
1797 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1793 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1798 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1794 qDebug("KO: Needed %d ms for saving.",msNeeded );
1799 QString savemes; 1795 QString savemes;
1800 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1796 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1801 setCaption(savemes); 1797 setCaption(savemes);
1802 } else 1798 } else
1803 setCaption(i18n("Saving cancelled!")); 1799 setCaption(i18n("Saving cancelled!"));
1804 mSyncManager->setBlockSave( false ); 1800 mSyncManager->setBlockSave( false );
1805} 1801}
1806 1802
1807void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1803void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1808{ 1804{
1809 if ( !e->isAutoRepeat() ) { 1805 if ( !e->isAutoRepeat() ) {
1810 mFlagKeyPressed = false; 1806 mFlagKeyPressed = false;
1811 } 1807 }
1812} 1808}
1813void MainWindow::keyPressEvent ( QKeyEvent * e ) 1809void MainWindow::keyPressEvent ( QKeyEvent * e )
1814{ 1810{
1815 qApp->processEvents(); 1811 qApp->processEvents();
1816 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1812 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1817 e->ignore(); 1813 e->ignore();
1818 // qDebug(" ignore %d",e->isAutoRepeat() ); 1814 // qDebug(" ignore %d",e->isAutoRepeat() );
1819 return; 1815 return;
1820 } 1816 }
1821 if (! e->isAutoRepeat() ) 1817 if (! e->isAutoRepeat() )
1822 mFlagKeyPressed = true; 1818 mFlagKeyPressed = true;
1823 KOPrefs *p = KOPrefs::instance(); 1819 KOPrefs *p = KOPrefs::instance();
1824 bool showSelectedDates = false; 1820 bool showSelectedDates = false;
1825 int size; 1821 int size;
1826 int pro = 0; 1822 int pro = 0;
1827 //qDebug("MainWindow::keyPressEvent "); 1823 //qDebug("MainWindow::keyPressEvent ");
1828 switch ( e->key() ) { 1824 switch ( e->key() ) {