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
@@ -1739,150 +1739,156 @@ void MainWindow::saveCalendar()
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