-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
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 | |||
@@ -1681,196 +1681,192 @@ void MainWindow::importQtopia() | |||
1681 | #else | 1681 | #else |
1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1685 | #endif | 1685 | #endif |
1686 | mView->importQtopia( categories, datebook, todolist ); | 1686 | mView->importQtopia( categories, datebook, todolist ); |
1687 | } | 1687 | } |
1688 | #if 0 | 1688 | #if 0 |
1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1690 | i18n("Not supported \non desktop!\n"), | 1690 | i18n("Not supported \non desktop!\n"), |
1691 | i18n("Ok"), i18n("Cancel"), 0, | 1691 | i18n("Ok"), i18n("Cancel"), 0, |
1692 | 0, 1 ); | 1692 | 0, 1 ); |
1693 | 1693 | ||
1694 | #endif | 1694 | #endif |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | void MainWindow::saveOnClose() | 1697 | void MainWindow::saveOnClose() |
1698 | { | 1698 | { |
1699 | KOPrefs *p = KOPrefs::instance(); | 1699 | KOPrefs *p = KOPrefs::instance(); |
1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1703 | if ( filterToolBar ) { | 1703 | if ( filterToolBar ) { |
1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1705 | } | 1705 | } |
1706 | #ifdef DESKTOP_VERSION | 1706 | #ifdef DESKTOP_VERSION |
1707 | 1707 | ||
1708 | QPoint myP; | 1708 | QPoint myP; |
1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1710 | if ( p->mToolBarHor ) | 1710 | if ( p->mToolBarHor ) |
1711 | p->mToolBarUp = myP.y() > height()/2; | 1711 | p->mToolBarUp = myP.y() > height()/2; |
1712 | else | 1712 | else |
1713 | p->mToolBarUp = myP.x() > width()/2; | 1713 | p->mToolBarUp = myP.x() > width()/2; |
1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1715 | if ( p->mToolBarHorV ) | 1715 | if ( p->mToolBarHorV ) |
1716 | p->mToolBarUpV = myP.y() > height()/2; | 1716 | p->mToolBarUpV = myP.y() > height()/2; |
1717 | else | 1717 | else |
1718 | p->mToolBarUpV = myP.x() > width()/2 ; | 1718 | p->mToolBarUpV = myP.x() > width()/2 ; |
1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1720 | if ( p->mToolBarHorN ) | 1720 | if ( p->mToolBarHorN ) |
1721 | p->mToolBarUpN = myP.y() > height()/2; | 1721 | p->mToolBarUpN = myP.y() > height()/2; |
1722 | else | 1722 | else |
1723 | p->mToolBarUpN = myP.x() > width()/2 ; | 1723 | p->mToolBarUpN = myP.x() > width()/2 ; |
1724 | if ( filterToolBar ) { | 1724 | if ( filterToolBar ) { |
1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1726 | if ( p->mToolBarHorF ) | 1726 | if ( p->mToolBarHorF ) |
1727 | p->mToolBarUpF = myP.y() > height()/2; | 1727 | p->mToolBarUpF = myP.y() > height()/2; |
1728 | else | 1728 | else |
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 | } |
1758 | void MainWindow::slotModifiedChanged( bool changed ) | 1758 | void 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 | } |
1774 | void MainWindow::saveStopTimer() | 1774 | void 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 | } |
1782 | void MainWindow::save() | 1778 | void 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 | ||
1807 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1803 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1808 | { | 1804 | { |
1809 | if ( !e->isAutoRepeat() ) { | 1805 | if ( !e->isAutoRepeat() ) { |
1810 | mFlagKeyPressed = false; | 1806 | mFlagKeyPressed = false; |
1811 | } | 1807 | } |
1812 | } | 1808 | } |
1813 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1809 | void 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() ) { |
1829 | case Qt::Key_Right: | 1825 | case Qt::Key_Right: |
1830 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1826 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1831 | mView->goNextMonth(); | 1827 | mView->goNextMonth(); |
1832 | else | 1828 | else |
1833 | mView->goNext(); | 1829 | mView->goNext(); |
1834 | showSelectedDates = true; | 1830 | showSelectedDates = true; |
1835 | break; | 1831 | break; |
1836 | case Qt::Key_Left: | 1832 | case Qt::Key_Left: |
1837 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1833 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1838 | mView->goPreviousMonth(); | 1834 | mView->goPreviousMonth(); |
1839 | else | 1835 | else |
1840 | mView->goPrevious(); | 1836 | mView->goPrevious(); |
1841 | showSelectedDates = true; | 1837 | showSelectedDates = true; |
1842 | break; | 1838 | break; |
1843 | case Qt::Key_Down: | 1839 | case Qt::Key_Down: |
1844 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1840 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1845 | break; | 1841 | break; |
1846 | case Qt::Key_Up: | 1842 | case Qt::Key_Up: |
1847 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1843 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1848 | break; | 1844 | break; |
1849 | case Qt::Key_K: | 1845 | case Qt::Key_K: |
1850 | mView->viewManager()->showMonthViewWeek(); | 1846 | mView->viewManager()->showMonthViewWeek(); |
1851 | break; | 1847 | break; |
1852 | case Qt::Key_I: | 1848 | case Qt::Key_I: |
1853 | mView->showIncidence(); | 1849 | mView->showIncidence(); |
1854 | break; | 1850 | break; |
1855 | case Qt::Key_Delete: | 1851 | case Qt::Key_Delete: |
1856 | case Qt::Key_Backspace: | 1852 | case Qt::Key_Backspace: |
1857 | mView->deleteIncidence(); | 1853 | mView->deleteIncidence(); |
1858 | break; | 1854 | break; |
1859 | case Qt::Key_D: | 1855 | case Qt::Key_D: |
1860 | mView->viewManager()->showDayView(); | 1856 | mView->viewManager()->showDayView(); |
1861 | showSelectedDates = true; | 1857 | showSelectedDates = true; |
1862 | break; | 1858 | break; |
1863 | case Qt::Key_O: | 1859 | case Qt::Key_O: |
1864 | mView->toggleFilerEnabled( ); | 1860 | mView->toggleFilerEnabled( ); |
1865 | break; | 1861 | break; |
1866 | case Qt::Key_0: | 1862 | case Qt::Key_0: |
1867 | case Qt::Key_1: | 1863 | case Qt::Key_1: |
1868 | case Qt::Key_2: | 1864 | case Qt::Key_2: |
1869 | case Qt::Key_3: | 1865 | case Qt::Key_3: |
1870 | case Qt::Key_4: | 1866 | case Qt::Key_4: |
1871 | case Qt::Key_5: | 1867 | case Qt::Key_5: |
1872 | case Qt::Key_6: | 1868 | case Qt::Key_6: |
1873 | case Qt::Key_7: | 1869 | case Qt::Key_7: |
1874 | case Qt::Key_8: | 1870 | case Qt::Key_8: |
1875 | case Qt::Key_9: | 1871 | case Qt::Key_9: |
1876 | pro = e->key()-48; | 1872 | pro = e->key()-48; |