summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-08 14:48:55 (UTC)
committer zautrix <zautrix>2005-02-08 14:48:55 (UTC)
commit584ed7893497b2adad5ba6c3e914d90b76973b92 (patch) (unidiff)
treea25b2c10338c32dc0a6bbf11e6bebeb059ec7bd0
parent41111b332c2a5f1b2ec152df309b9199f5e9c921 (diff)
downloadkdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.zip
kdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.tar.gz
kdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 61c39f5..856f7db 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1661,406 +1661,406 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1661 mView->newSubTodo(); 1661 mView->newSubTodo();
1662 else 1662 else
1663 mView->dialogManager()->showSearchDialog(); 1663 mView->dialogManager()->showSearchDialog();
1664 break; 1664 break;
1665 case Qt::Key_Y : 1665 case Qt::Key_Y :
1666 case Qt::Key_Z : 1666 case Qt::Key_Z :
1667 mView->viewManager()->showWorkWeekView(); 1667 mView->viewManager()->showWorkWeekView();
1668 showSelectedDates = true; 1668 showSelectedDates = true;
1669 break; 1669 break;
1670 case Qt::Key_U : 1670 case Qt::Key_U :
1671 mView->viewManager()->showWeekView(); 1671 mView->viewManager()->showWeekView();
1672 showSelectedDates = true; 1672 showSelectedDates = true;
1673 break; 1673 break;
1674 case Qt::Key_H : 1674 case Qt::Key_H :
1675 keyBindings(); 1675 keyBindings();
1676 break; 1676 break;
1677 case Qt::Key_W: 1677 case Qt::Key_W:
1678 mView->viewManager()->showWhatsNextView(); 1678 mView->viewManager()->showWhatsNextView();
1679 break; 1679 break;
1680 case Qt::Key_L: 1680 case Qt::Key_L:
1681 mView->viewManager()->showListView(); 1681 mView->viewManager()->showListView();
1682 break; 1682 break;
1683 case Qt::Key_N: 1683 case Qt::Key_N:
1684 mView->viewManager()->showNextXView(); 1684 mView->viewManager()->showNextXView();
1685 showSelectedDates = true; 1685 showSelectedDates = true;
1686 break; 1686 break;
1687 case Qt::Key_V: 1687 case Qt::Key_V:
1688 mView->viewManager()->showTodoView(); 1688 mView->viewManager()->showTodoView();
1689 break; 1689 break;
1690 case Qt::Key_C: 1690 case Qt::Key_C:
1691 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1691 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1692 break; 1692 break;
1693 case Qt::Key_P: 1693 case Qt::Key_P:
1694 mView->showDatePicker( ); 1694 mView->showDatePicker( );
1695 break; 1695 break;
1696 case Qt::Key_F: 1696 case Qt::Key_F:
1697 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1697 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1698 mView->editFilters(); 1698 mView->editFilters();
1699 else 1699 else
1700 mView->toggleFilter(); 1700 mView->toggleFilter();
1701 break; 1701 break;
1702 case Qt::Key_X: 1702 case Qt::Key_X:
1703 mView->toggleDateNavigatorWidget(); 1703 mView->toggleDateNavigatorWidget();
1704 break; 1704 break;
1705 case Qt::Key_Space: 1705 case Qt::Key_Space:
1706 mView->toggleExpand(); 1706 mView->toggleExpand();
1707 break; 1707 break;
1708 case Qt::Key_A: 1708 case Qt::Key_A:
1709 mView->toggleAllDaySize(); 1709 mView->toggleAllDaySize();
1710 break; 1710 break;
1711 case Qt::Key_T: 1711 case Qt::Key_T:
1712 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1712 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1713 mView->newTodo(); 1713 mView->newTodo();
1714 else { 1714 else {
1715 mView->goToday(); 1715 mView->goToday();
1716 showSelectedDates = true; 1716 showSelectedDates = true;
1717 } 1717 }
1718 break; 1718 break;
1719 case Qt::Key_J: 1719 case Qt::Key_J:
1720 mView->viewManager()->showJournalView(); 1720 mView->viewManager()->showJournalView();
1721 break; 1721 break;
1722 case Qt::Key_B: 1722 case Qt::Key_B:
1723 mView->editIncidenceDescription();; 1723 mView->editIncidenceDescription();;
1724 break; 1724 break;
1725 // case Qt::Key_Return: 1725 // case Qt::Key_Return:
1726 case Qt::Key_E: 1726 case Qt::Key_E:
1727 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1727 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1728 mView->newEvent(); 1728 mView->newEvent();
1729 else 1729 else
1730 mView->editIncidence(); 1730 mView->editIncidence();
1731 break; 1731 break;
1732 case Qt::Key_Plus: 1732 case Qt::Key_Plus:
1733 size = p->mHourSize +2; 1733 size = p->mHourSize +2;
1734 if ( size <= 22 ) 1734 if ( size <= 22 )
1735 configureAgenda( size ); 1735 configureAgenda( size );
1736 break; 1736 break;
1737 case Qt::Key_Minus: 1737 case Qt::Key_Minus:
1738 size = p->mHourSize - 2; 1738 size = p->mHourSize - 2;
1739 if ( size >= 4 ) 1739 if ( size >= 4 )
1740 configureAgenda( size ); 1740 configureAgenda( size );
1741 break; 1741 break;
1742 1742
1743 1743
1744 default: 1744 default:
1745 e->ignore(); 1745 e->ignore();
1746 } 1746 }
1747 if ( pro > 0 ) { 1747 if ( pro > 0 ) {
1748 mView->selectFilter( pro-1 ); 1748 mView->selectFilter( pro-1 );
1749 } 1749 }
1750 if ( showSelectedDates ) { 1750 if ( showSelectedDates ) {
1751 ;// setCaptionToDates(); 1751 ;// setCaptionToDates();
1752 } 1752 }
1753 1753
1754} 1754}
1755 1755
1756void MainWindow::fillFilterMenu() 1756void MainWindow::fillFilterMenu()
1757{ 1757{
1758 selectFilterMenu->clear(); 1758 selectFilterMenu->clear();
1759 bool disable = false; 1759 bool disable = false;
1760 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1760 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1761 selectFilterMenu->insertSeparator(); 1761 selectFilterMenu->insertSeparator();
1762 if ( mView->filterView()->filtersEnabled() ) { 1762 if ( mView->filterView()->filtersEnabled() ) {
1763 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1763 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1764 } 1764 }
1765 else { 1765 else {
1766 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1766 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1767 disable = true; 1767 disable = true;
1768 } 1768 }
1769 selectFilterMenu->insertSeparator(); 1769 selectFilterMenu->insertSeparator();
1770 QPtrList<CalFilter> fili = mView->filters(); 1770 QPtrList<CalFilter> fili = mView->filters();
1771 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1771 CalFilter *curfilter = mView->filterView()->selectedFilter();
1772 CalFilter *filter = fili.first(); 1772 CalFilter *filter = fili.first();
1773 int iii = 2; 1773 int iii = 2;
1774 while(filter) { 1774 while(filter) {
1775 selectFilterMenu->insertItem( filter->name(), iii ); 1775 selectFilterMenu->insertItem( filter->name(), iii );
1776 if ( filter == curfilter) 1776 if ( filter == curfilter)
1777 selectFilterMenu->setItemChecked( iii, true ); 1777 selectFilterMenu->setItemChecked( iii, true );
1778 if ( disable ) 1778 if ( disable )
1779 selectFilterMenu->setItemEnabled( iii, false ); 1779 selectFilterMenu->setItemEnabled( iii, false );
1780 filter = fili.next(); 1780 filter = fili.next();
1781 ++iii; 1781 ++iii;
1782 } 1782 }
1783} 1783}
1784void MainWindow::selectFilter( int fil ) 1784void MainWindow::selectFilter( int fil )
1785{ 1785{
1786 if ( fil == 0 ) { 1786 if ( fil == 0 ) {
1787 mView->editFilters( ); 1787 mView->editFilters( );
1788 } else if ( fil == 1 ){ 1788 } else if ( fil == 1 ){
1789 mView->toggleFilerEnabled( ); 1789 mView->toggleFilerEnabled( );
1790 } else { 1790 } else {
1791 mView->selectFilter( fil-2 ); 1791 mView->selectFilter( fil-2 );
1792 } 1792 }
1793} 1793}
1794void MainWindow::configureToolBar( int item ) 1794void MainWindow::configureToolBar( int item )
1795{ 1795{
1796 1796
1797 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1797 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1798 KOPrefs *p = KOPrefs::instance(); 1798 KOPrefs *p = KOPrefs::instance();
1799 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1799 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1800 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1800 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1801 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1801 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1802 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1802 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1803 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1803 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1804 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1804 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1805 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1805 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1806 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1806 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1807 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1807 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1808 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1808 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1809 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1809 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1810 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1810 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1811 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1811 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1812 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1812 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1813 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1813 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1814 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1814 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1815 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1815 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1816 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1816 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1817 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1817 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1818 // initActions(); 1818 // initActions();
1819} 1819}
1820 1820
1821void MainWindow::setCaptionToDates() 1821void MainWindow::setCaptionToDates()
1822{ 1822{
1823 QString selDates; 1823 QString selDates;
1824 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1824 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1825 if (mView->startDate() < mView->endDate() ) 1825 if (mView->startDate() < mView->endDate() )
1826 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1826 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1827 else { 1827 else {
1828 QString addString; 1828 QString addString;
1829 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1829 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1830 addString = i18n("Today"); 1830 addString = i18n("Today");
1831 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1831 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1832 addString = i18n("Tomorrow"); 1832 addString = i18n("Tomorrow");
1833 if ( !addString.isEmpty() ) 1833 if ( !addString.isEmpty() )
1834 selDates = addString+", "+selDates ; 1834 selDates = addString+", "+selDates ;
1835 } 1835 }
1836 setCaption( i18n("Dates: ") + selDates ); 1836 setCaption( i18n("Dates: ") + selDates );
1837 1837
1838} 1838}
1839void MainWindow::showConfigureAgenda( ) 1839void MainWindow::showConfigureAgenda( )
1840{ 1840{
1841 int iii; 1841 int iii;
1842 for ( iii = 1;iii<= 10 ;++iii ){ 1842 for ( iii = 1;iii<= 10 ;++iii ){
1843 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1843 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1844 } 1844 }
1845 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1845 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1846} 1846}
1847void MainWindow::configureAgenda( int item ) 1847void MainWindow::configureAgenda( int item )
1848{ 1848{
1849 if ( KOPrefs::instance()->mHourSize == item ) 1849 if ( KOPrefs::instance()->mHourSize == item )
1850 return; 1850 return;
1851 KOPrefs::instance()->mHourSize=item; 1851 KOPrefs::instance()->mHourSize=item;
1852 mView->viewManager()->agendaView()->updateConfig(); 1852 mView->viewManager()->agendaView()->updateConfig();
1853} 1853}
1854 1854
1855void MainWindow::saveCalendar() 1855void MainWindow::saveCalendar()
1856{ 1856{
1857 QString fn = KOPrefs::instance()->mLastSaveFile; 1857 QString fn = KOPrefs::instance()->mLastSaveFile;
1858 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1858 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1859 1859
1860 if ( fn == "" ) 1860 if ( fn == "" )
1861 return; 1861 return;
1862 QFileInfo info; 1862 QFileInfo info;
1863 info.setFile( fn ); 1863 info.setFile( fn );
1864 QString mes; 1864 QString mes;
1865 bool createbup = true; 1865 bool createbup = true;
1866 if ( info. exists() ) { 1866 if ( info. exists() ) {
1867 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1867 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1869 i18n("Overwrite!"), i18n("Cancel"), 0, 1869 i18n("Overwrite!"), i18n("Cancel"), 0,
1870 0, 1 ); 1870 0, 1 );
1871 if ( result != 0 ) { 1871 if ( result != 0 ) {
1872 createbup = false; 1872 createbup = false;
1873 } 1873 }
1874 } 1874 }
1875 if ( createbup ) { 1875 if ( createbup ) {
1876 mView->saveCalendar( fn ); 1876 mView->saveCalendar( fn );
1877 mes = i18n("KO/Pi:Saved %1").arg(fn); 1877 mes = i18n("KO/Pi:Saved %1").arg(fn);
1878 KOPrefs::instance()->mLastSaveFile = fn; 1878 KOPrefs::instance()->mLastSaveFile = fn;
1879 setCaption(mes); 1879 setCaption(mes);
1880 } 1880 }
1881} 1881}
1882void MainWindow::loadCalendar() 1882void MainWindow::loadCalendar()
1883{ 1883{
1884 1884
1885 QString fn = KOPrefs::instance()->mLastLoadFile; 1885 QString fn = KOPrefs::instance()->mLastLoadFile;
1886 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1886 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1887 1887
1888 if ( fn == "" ) 1888 if ( fn == "" )
1889 return; 1889 return;
1890 QFileInfo info; 1890 QFileInfo info;
1891 info.setFile( fn ); 1891 info.setFile( fn );
1892 QString mess; 1892 QString mess;
1893 bool loadbup = true; 1893 bool loadbup = true;
1894 if ( info. exists() ) { 1894 if ( info. exists() ) {
1895 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1895 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1896 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1896 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1897 mess, 1897 mess,
1898 i18n("Load!"), i18n("Cancel"), 0, 1898 i18n("Load!"), i18n("Cancel"), 0,
1899 0, 1 ); 1899 0, 1 );
1900 if ( result != 0 ) { 1900 if ( result != 0 ) {
1901 loadbup = false; 1901 loadbup = false;
1902 } 1902 }
1903 } else { 1903 } else {
1904 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1904 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1905 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1905 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1906 0, 1 ); 1906 0, 1 );
1907 1907
1908 return; 1908 return;
1909 } 1909 }
1910 if ( loadbup ) { 1910 if ( loadbup ) {
1911 mView->openCalendar( fn ); 1911 mView->openCalendar( fn );
1912 KOPrefs::instance()->mLastLoadFile = fn; 1912 KOPrefs::instance()->mLastLoadFile = fn;
1913 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1913 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1914 setCaption(mess); 1914 setCaption(mess);
1915 } 1915 }
1916 1916
1917} 1917}
1918void MainWindow::quickImportIcal() 1918void MainWindow::quickImportIcal()
1919{ 1919{
1920 importFile( KOPrefs::instance()->mLastImportFile, false ); 1920 importFile( KOPrefs::instance()->mLastImportFile, false );
1921} 1921}
1922void MainWindow::importFile( QString fn, bool quick ) 1922void MainWindow::importFile( QString fn, bool quick )
1923{ 1923{
1924 QFileInfo info; 1924 QFileInfo info;
1925 info.setFile( fn ); 1925 info.setFile( fn );
1926 QString mess; 1926 QString mess;
1927 bool loadbup = true; 1927 bool loadbup = true;
1928 if ( !info. exists() ) { 1928 if ( !info. exists() ) {
1929 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1929 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1930 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1930 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1931 mess ); 1931 mess );
1932 return; 1932 return;
1933 } 1933 }
1934 int result = 0; 1934 int result = 0;
1935 if ( !quick ) { 1935 if ( !quick ) {
1936 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 )); 1936 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 ));
1937 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1937 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1938 mess, 1938 mess,
1939 "Import", "Cancel", 0, 1939 "Import", "Cancel", 0,
1940 0, 1 ); 1940 0, 1 );
1941 } 1941 }
1942 if ( result == 0 ) { 1942 if ( result == 0 ) {
1943 if ( mView->openCalendar( fn, true )) { 1943 if ( mView->openCalendar( fn, true )) {
1944 KOPrefs::instance()->mLastImportFile = fn; 1944 KOPrefs::instance()->mLastImportFile = fn;
1945 setCaption(i18n("Imported file successfully")); 1945 setCaption(i18n("Imported file successfully"));
1946 } else { 1946 } else {
1947 setCaption(i18n("Error importing file")); 1947 setCaption(i18n("Error importing file"));
1948 } 1948 }
1949 } 1949 }
1950} 1950}
1951 1951
1952void MainWindow::importIcal() 1952void MainWindow::importIcal()
1953{ 1953{
1954 1954
1955 QString fn =KOPrefs::instance()->mLastImportFile; 1955 QString fn =KOPrefs::instance()->mLastImportFile;
1956 1956
1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1958 if ( fn == "" ) 1958 if ( fn == "" )
1959 return; 1959 return;
1960 importFile( fn, true ); 1960 importFile( fn, true );
1961 1961
1962} 1962}
1963 1963
1964void MainWindow::exportVCalendar() 1964void MainWindow::exportVCalendar()
1965{ 1965{
1966 QString fn = KOPrefs::instance()->mLastVcalFile; 1966 QString fn = KOPrefs::instance()->mLastVcalFile;
1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1968 if ( fn == "" ) 1968 if ( fn == "" )
1969 return; 1969 return;
1970 QFileInfo info; 1970 QFileInfo info;
1971 info.setFile( fn ); 1971 info.setFile( fn );
1972 QString mes; 1972 QString mes;
1973 bool createbup = true; 1973 bool createbup = true;
1974 if ( info. exists() ) { 1974 if ( info. exists() ) {
1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1977 i18n("Overwrite!"), i18n("Cancel"), 0, 1977 i18n("Overwrite!"), i18n("Cancel"), 0,
1978 0, 1 ); 1978 0, 1 );
1979 if ( result != 0 ) { 1979 if ( result != 0 ) {
1980 createbup = false; 1980 createbup = false;
1981 } 1981 }
1982 } 1982 }
1983 if ( createbup ) { 1983 if ( createbup ) {
1984 if ( mView->exportVCalendar( fn ) ) { 1984 if ( mView->exportVCalendar( fn ) ) {
1985 KOPrefs::instance()->mLastVcalFile = fn; 1985 KOPrefs::instance()->mLastVcalFile = fn;
1986 if ( fn.length() > 20 ) 1986 if ( fn.length() > 20 )
1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1988 else 1988 else
1989 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1989 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1990 setCaption(mes); 1990 setCaption(mes);
1991 } 1991 }
1992 } 1992 }
1993 1993
1994} 1994}
1995 1995
1996void MainWindow::syncFileRequest() 1996void MainWindow::syncFileRequest()
1997{ 1997{
1998 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1998 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1999 mSyncManager->slotSyncMenu( 999 ); 1999 mSyncManager->slotSyncMenu( 999 );
2000 } 2000 }
2001 save(); 2001 save();
2002} 2002}
2003void MainWindow::getFile( bool success ) 2003void MainWindow::getFile( bool success )
2004{ 2004{
2005 if ( ! success ) { 2005 if ( ! success ) {
2006 setCaption( i18n("Error receiving file. Nothing changed!") ); 2006 setCaption( i18n("Error receiving file. Nothing changed!") );
2007 return; 2007 return;
2008 } 2008 }
2009 mView->openCalendar( defaultFileName() ); 2009 mView->openCalendar( defaultFileName() );
2010 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2010 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2011 mSyncManager->slotSyncMenu( 999 ); 2011 mSyncManager->slotSyncMenu( 999 );
2012 } 2012 }
2013 setCaption( i18n("Pi-Sync successful!") ); 2013 setCaption( i18n("Pi-Sync successful!") );
2014} 2014}
2015 2015
2016void MainWindow::printSel( ) 2016void MainWindow::printSel( )
2017{ 2017{
2018 mView->viewManager()->agendaView()->agenda()->printSelection(); 2018 mView->viewManager()->agendaView()->agenda()->printSelection();
2019} 2019}
2020 2020
2021void MainWindow::printCal() 2021void MainWindow::printCal()
2022{ 2022{
2023 mView->print();//mCp->showDialog(); 2023 mView->print();//mCp->showDialog();
2024} 2024}
2025 2025
2026 2026
2027#include "libkdepim/kdatepicker.h" 2027#include "libkdepim/kdatepicker.h"
2028#include <kdatetbl.h> 2028#include <kdatetbl.h>
2029void MainWindow::weekAction() 2029void MainWindow::weekAction()
2030{ 2030{
2031 int month; 2031 int month;
2032 KPopupFrame* popup = new KPopupFrame(this); 2032 KPopupFrame* popup = new KPopupFrame(this);
2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup); 2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup);
2034 // ----- 2034 // -----
2035 picker->resize(picker->sizeHint()); 2035 picker->resize(picker->sizeHint());
2036 popup->setMainWidget(picker); 2036 popup->setMainWidget(picker);
2037 picker->setFocus(); 2037 picker->setFocus();
2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2039 int x = 0; 2039 int x = 0;
2040 int y = iconToolBar->height(); 2040 int y = iconToolBar->height();
2041 int dX = 0; 2041 int dX = 0;
2042 int dY = 0; 2042 int dY = 0;
2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2044 if ( iconToolBar->y() > height()/2 ) { 2044 if ( iconToolBar->y() > height()/2 ) {
2045 dY = iconToolBar->height()+picker->sizeHint().height(); 2045 dY = picker->sizeHint().height()+8;
2046 y = 0; 2046 y = 0;
2047 } 2047 }
2048 } else { 2048 } else {
2049 if ( iconToolBar->x() > width()/2 ) { // right side 2049 if ( iconToolBar->x() > width()/2 ) { // right side
2050 x=0; 2050 x=0;
2051 dX= iconToolBar->width()+picker->sizeHint().width(); 2051 dX= picker->sizeHint().width()+8;
2052 y = 0; 2052 y = 0;
2053 } else { 2053 } else {
2054 x= iconToolBar->width(); 2054 x= iconToolBar->width();
2055 y = 0; 2055 y = 0;
2056 } 2056 }
2057 } 2057 }
2058 qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2058 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2059 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2059 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2060 { 2060 {
2061 month = picker->getResult(); 2061 month = picker->getResult();
2062 emit selectWeek ( month ); 2062 emit selectWeek ( month );
2063 //qDebug("weekSelected %d ", month); 2063 //qDebug("weekSelected %d ", month);
2064 } 2064 }
2065 delete popup; 2065 delete popup;
2066} 2066}