summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 63484d6..e3dad94 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1611,278 +1611,284 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1611 size = p->mHourSize - 2; 1611 size = p->mHourSize - 2;
1612 if ( size >= 4 ) 1612 if ( size >= 4 )
1613 configureAgenda( size ); 1613 configureAgenda( size );
1614 break; 1614 break;
1615 1615
1616 1616
1617 default: 1617 default:
1618 e->ignore(); 1618 e->ignore();
1619 } 1619 }
1620 if ( pro > 0 ) { 1620 if ( pro > 0 ) {
1621 mView->selectFilter( pro-1 ); 1621 mView->selectFilter( pro-1 );
1622 } 1622 }
1623 if ( showSelectedDates ) { 1623 if ( showSelectedDates ) {
1624 ;// setCaptionToDates(); 1624 ;// setCaptionToDates();
1625 } 1625 }
1626 1626
1627} 1627}
1628 1628
1629void MainWindow::fillFilterMenu() 1629void MainWindow::fillFilterMenu()
1630{ 1630{
1631 selectFilterMenu->clear(); 1631 selectFilterMenu->clear();
1632 bool disable = false; 1632 bool disable = false;
1633 if ( mView->filterView()->filtersEnabled() ) { 1633 if ( mView->filterView()->filtersEnabled() ) {
1634 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1634 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1635 } 1635 }
1636 else { 1636 else {
1637 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1637 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1638 disable = true; 1638 disable = true;
1639 } 1639 }
1640 selectFilterMenu->insertSeparator(); 1640 selectFilterMenu->insertSeparator();
1641 QPtrList<CalFilter> fili = mView->filters(); 1641 QPtrList<CalFilter> fili = mView->filters();
1642 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1642 CalFilter *curfilter = mView->filterView()->selectedFilter();
1643 CalFilter *filter = fili.first(); 1643 CalFilter *filter = fili.first();
1644 int iii = 1; 1644 int iii = 1;
1645 while(filter) { 1645 while(filter) {
1646 selectFilterMenu->insertItem( filter->name(), iii ); 1646 selectFilterMenu->insertItem( filter->name(), iii );
1647 if ( filter == curfilter) 1647 if ( filter == curfilter)
1648 selectFilterMenu->setItemChecked( iii, true ); 1648 selectFilterMenu->setItemChecked( iii, true );
1649 if ( disable ) 1649 if ( disable )
1650 selectFilterMenu->setItemEnabled( iii, false ); 1650 selectFilterMenu->setItemEnabled( iii, false );
1651 filter = fili.next(); 1651 filter = fili.next();
1652 ++iii; 1652 ++iii;
1653 } 1653 }
1654} 1654}
1655void MainWindow::selectFilter( int fil ) 1655void MainWindow::selectFilter( int fil )
1656{ 1656{
1657 if ( fil == 0 ) { 1657 if ( fil == 0 ) {
1658 mView->toggleFilerEnabled( ); 1658 mView->toggleFilerEnabled( );
1659 } else { 1659 } else {
1660 mView->selectFilter( fil-1 ); 1660 mView->selectFilter( fil-1 );
1661 } 1661 }
1662} 1662}
1663void MainWindow::configureToolBar( int item ) 1663void MainWindow::configureToolBar( int item )
1664{ 1664{
1665 1665
1666 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1666 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1667 KOPrefs *p = KOPrefs::instance(); 1667 KOPrefs *p = KOPrefs::instance();
1668 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1668 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1669 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1669 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1670 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1670 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1671 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1671 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1672 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1672 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1673 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1673 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1674 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1674 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1675 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1675 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1676 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1676 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1677 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1677 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1678 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1678 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1679 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1679 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1680 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1680 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1681 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1681 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1682 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1682 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1683 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1683 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1684 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1684 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1685 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1685 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1686 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1686 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1687 // initActions(); 1687 // initActions();
1688} 1688}
1689 1689
1690void MainWindow::setCaptionToDates() 1690void MainWindow::setCaptionToDates()
1691{ 1691{
1692 QString selDates; 1692 QString selDates;
1693 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1693 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1694 if (mView->startDate() < mView->endDate() ) 1694 if (mView->startDate() < mView->endDate() )
1695 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1695 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1696 setCaption( i18n("Dates: ") + selDates ); 1696 setCaption( i18n("Dates: ") + selDates );
1697 1697
1698} 1698}
1699// parameter item == 0: reinit 1699// parameter item == 0: reinit
1700void MainWindow::configureAgenda( int item ) 1700void MainWindow::configureAgenda( int item )
1701{ 1701{
1702 1702
1703 KOPrefs *p = KOPrefs::instance(); 1703 KOPrefs *p = KOPrefs::instance();
1704 1704
1705 int i; 1705 int i;
1706 if ( item == 1 ) { 1706 if ( item == 1 ) {
1707 mView->toggleAllDaySize(); 1707 mView->toggleAllDaySize();
1708 return; 1708 return;
1709 } 1709 }
1710 // do not allow 4 for widgets higher than 480 1710 // do not allow 4 for widgets higher than 480
1711 // if ( QApplication::desktop()->height() > 480 ) { 1711 // if ( QApplication::desktop()->height() > 480 ) {
1712// if ( item == 4 ) 1712// if ( item == 4 )
1713// item = 6; 1713// item = 6;
1714// } 1714// }
1715 for ( i = 4; i <= 18; i= i+2 ) 1715 for ( i = 4; i <= 18; i= i+2 )
1716 configureAgendaMenu->setItemChecked( i, false ); 1716 configureAgendaMenu->setItemChecked( i, false );
1717 configureAgendaMenu->setItemChecked( item, true ); 1717 configureAgendaMenu->setItemChecked( item, true );
1718 if ( p->mHourSize == item ) 1718 if ( p->mHourSize == item )
1719 return; 1719 return;
1720 p->mHourSize=item; 1720 p->mHourSize=item;
1721 mView->viewManager()->agendaView()->updateConfig(); 1721 mView->viewManager()->agendaView()->updateConfig();
1722} 1722}
1723 1723
1724void MainWindow::saveCalendar() 1724void MainWindow::saveCalendar()
1725{ 1725{
1726 QString fn = KOPrefs::instance()->mLastSaveFile; 1726 QString fn = KOPrefs::instance()->mLastSaveFile;
1727 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1727 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1728 1728
1729 if ( fn == "" ) 1729 if ( fn == "" )
1730 return; 1730 return;
1731 QFileInfo info; 1731 QFileInfo info;
1732 info.setFile( fn ); 1732 info.setFile( fn );
1733 QString mes; 1733 QString mes;
1734 bool createbup = true; 1734 bool createbup = true;
1735 if ( info. exists() ) { 1735 if ( info. exists() ) {
1736 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1736 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1737 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1737 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1738 i18n("Overwrite!"), i18n("Cancel"), 0, 1738 i18n("Overwrite!"), i18n("Cancel"), 0,
1739 0, 1 ); 1739 0, 1 );
1740 if ( result != 0 ) { 1740 if ( result != 0 ) {
1741 createbup = false; 1741 createbup = false;
1742 } 1742 }
1743 } 1743 }
1744 if ( createbup ) { 1744 if ( createbup ) {
1745 mView->saveCalendar( fn ); 1745 mView->saveCalendar( fn );
1746 mes = i18n("KO/Pi:Saved %1").arg(fn); 1746 mes = i18n("KO/Pi:Saved %1").arg(fn);
1747 KOPrefs::instance()->mLastSaveFile = fn; 1747 KOPrefs::instance()->mLastSaveFile = fn;
1748 setCaption(mes); 1748 setCaption(mes);
1749 } 1749 }
1750} 1750}
1751void MainWindow::loadCalendar() 1751void MainWindow::loadCalendar()
1752{ 1752{
1753 1753
1754 QString fn = KOPrefs::instance()->mLastLoadFile; 1754 QString fn = KOPrefs::instance()->mLastLoadFile;
1755 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1755 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1756 1756
1757 if ( fn == "" ) 1757 if ( fn == "" )
1758 return; 1758 return;
1759 QFileInfo info; 1759 QFileInfo info;
1760 info.setFile( fn ); 1760 info.setFile( fn );
1761 QString mess; 1761 QString mess;
1762 bool loadbup = true; 1762 bool loadbup = true;
1763 if ( info. exists() ) { 1763 if ( info. exists() ) {
1764 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1764 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1765 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1765 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1766 mess, 1766 mess,
1767 i18n("Load!"), i18n("Cancel"), 0, 1767 i18n("Load!"), i18n("Cancel"), 0,
1768 0, 1 ); 1768 0, 1 );
1769 if ( result != 0 ) { 1769 if ( result != 0 ) {
1770 loadbup = false; 1770 loadbup = false;
1771 } 1771 }
1772 } else { 1772 } else {
1773 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1773 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1774 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1774 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1775 0, 1 ); 1775 0, 1 );
1776 1776
1777 return; 1777 return;
1778 } 1778 }
1779 if ( loadbup ) { 1779 if ( loadbup ) {
1780 mView->openCalendar( fn ); 1780 mView->openCalendar( fn );
1781 KOPrefs::instance()->mLastLoadFile = fn; 1781 KOPrefs::instance()->mLastLoadFile = fn;
1782 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1782 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1783 setCaption(mess); 1783 setCaption(mess);
1784 } 1784 }
1785 1785
1786} 1786}
1787void MainWindow::quickImportIcal() 1787void MainWindow::quickImportIcal()
1788{ 1788{
1789 importFile( KOPrefs::instance()->mLastImportFile, false ); 1789 importFile( KOPrefs::instance()->mLastImportFile, false );
1790} 1790}
1791void MainWindow::importFile( QString fn, bool quick ) 1791void MainWindow::importFile( QString fn, bool quick )
1792{ 1792{
1793 QFileInfo info; 1793 QFileInfo info;
1794 info.setFile( fn ); 1794 info.setFile( fn );
1795 QString mess; 1795 QString mess;
1796 bool loadbup = true; 1796 bool loadbup = true;
1797 if ( !info. exists() ) { 1797 if ( !info. exists() ) {
1798 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1798 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1799 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1799 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1800 mess ); 1800 mess );
1801 return; 1801 return;
1802 } 1802 }
1803 int result = 0; 1803 int result = 0;
1804 if ( !quick ) { 1804 if ( !quick ) {
1805 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 )); 1805 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 ));
1806 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1806 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1807 mess, 1807 mess,
1808 "Import", "Cancel", 0, 1808 "Import", "Cancel", 0,
1809 0, 1 ); 1809 0, 1 );
1810 } 1810 }
1811 if ( result == 0 ) { 1811 if ( result == 0 ) {
1812 if ( mView->openCalendar( fn, true )) { 1812 if ( mView->openCalendar( fn, true )) {
1813 KOPrefs::instance()->mLastImportFile = fn; 1813 KOPrefs::instance()->mLastImportFile = fn;
1814 setCaption(i18n("Imported file successfully")); 1814 setCaption(i18n("Imported file successfully"));
1815 } else { 1815 } else {
1816 setCaption(i18n("Error importing file")); 1816 setCaption(i18n("Error importing file"));
1817 } 1817 }
1818 } 1818 }
1819} 1819}
1820 1820
1821void MainWindow::importIcal() 1821void MainWindow::importIcal()
1822{ 1822{
1823 1823
1824 QString fn =KOPrefs::instance()->mLastImportFile; 1824 QString fn =KOPrefs::instance()->mLastImportFile;
1825 1825
1826 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1826 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1827 if ( fn == "" ) 1827 if ( fn == "" )
1828 return; 1828 return;
1829 importFile( fn, true ); 1829 importFile( fn, true );
1830 1830
1831} 1831}
1832 1832
1833void MainWindow::exportVCalendar() 1833void MainWindow::exportVCalendar()
1834{ 1834{
1835 QString fn = KOPrefs::instance()->mLastVcalFile; 1835 QString fn = KOPrefs::instance()->mLastVcalFile;
1836 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1836 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1837 if ( fn == "" ) 1837 if ( fn == "" )
1838 return; 1838 return;
1839 QFileInfo info; 1839 QFileInfo info;
1840 info.setFile( fn ); 1840 info.setFile( fn );
1841 QString mes; 1841 QString mes;
1842 bool createbup = true; 1842 bool createbup = true;
1843 if ( info. exists() ) { 1843 if ( info. exists() ) {
1844 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1844 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1845 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1845 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1846 i18n("Overwrite!"), i18n("Cancel"), 0, 1846 i18n("Overwrite!"), i18n("Cancel"), 0,
1847 0, 1 ); 1847 0, 1 );
1848 if ( result != 0 ) { 1848 if ( result != 0 ) {
1849 createbup = false; 1849 createbup = false;
1850 } 1850 }
1851 } 1851 }
1852 if ( createbup ) { 1852 if ( createbup ) {
1853 if ( mView->exportVCalendar( fn ) ) { 1853 if ( mView->exportVCalendar( fn ) ) {
1854 KOPrefs::instance()->mLastVcalFile = fn; 1854 KOPrefs::instance()->mLastVcalFile = fn;
1855 if ( fn.length() > 20 ) 1855 if ( fn.length() > 20 )
1856 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1856 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1857 else 1857 else
1858 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1858 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1859 setCaption(mes); 1859 setCaption(mes);
1860 } 1860 }
1861 } 1861 }
1862 1862
1863} 1863}
1864 1864
1865void MainWindow::syncFileRequest() 1865void MainWindow::syncFileRequest()
1866{ 1866{
1867 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1868 mSyncManager->slotSyncMenu( 999 );
1869 }
1867 save(); 1870 save();
1868} 1871}
1869void MainWindow::getFile( bool success ) 1872void MainWindow::getFile( bool success )
1870{ 1873{
1871 if ( ! success ) { 1874 if ( ! success ) {
1872 setCaption( i18n("Error receiving file. Nothing changed!") ); 1875 setCaption( i18n("Error receiving file. Nothing changed!") );
1873 return; 1876 return;
1874 } 1877 }
1875 mView->openCalendar( defaultFileName() ); 1878 mView->openCalendar( defaultFileName() );
1879 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1880 mSyncManager->slotSyncMenu( 999 );
1881 }
1876 setCaption( i18n("Pi-Sync successful!") ); 1882 setCaption( i18n("Pi-Sync successful!") );
1877} 1883}
1878 1884
1879void MainWindow::printSel( ) 1885void MainWindow::printSel( )
1880{ 1886{
1881 mView->viewManager()->agendaView()->agenda()->printSelection(); 1887 mView->viewManager()->agendaView()->agenda()->printSelection();
1882} 1888}
1883 1889
1884void MainWindow::printCal() 1890void MainWindow::printCal()
1885{ 1891{
1886 mView->print();//mCp->showDialog(); 1892 mView->print();//mCp->showDialog();
1887} 1893}
1888 1894