author | zautrix <zautrix> | 2005-02-08 14:48:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-08 14:48:55 (UTC) |
commit | 584ed7893497b2adad5ba6c3e914d90b76973b92 (patch) (unidiff) | |
tree | a25b2c10338c32dc0a6bbf11e6bebeb059ec7bd0 | |
parent | 41111b332c2a5f1b2ec152df309b9199f5e9c921 (diff) | |
download | kdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.zip kdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.tar.gz kdepimpi-584ed7893497b2adad5ba6c3e914d90b76973b92.tar.bz2 |
fix
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
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 | |||
@@ -1853,214 +1853,214 @@ void MainWindow::configureAgenda( int item ) | |||
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | void MainWindow::saveCalendar() | 1855 | void 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 | } |
1882 | void MainWindow::loadCalendar() | 1882 | void 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 | } |
1918 | void MainWindow::quickImportIcal() | 1918 | void MainWindow::quickImportIcal() |
1919 | { | 1919 | { |
1920 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1920 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1921 | } | 1921 | } |
1922 | void MainWindow::importFile( QString fn, bool quick ) | 1922 | void 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 | ||
1952 | void MainWindow::importIcal() | 1952 | void 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 | ||
1964 | void MainWindow::exportVCalendar() | 1964 | void 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 | ||
1996 | void MainWindow::syncFileRequest() | 1996 | void 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 | } |
2003 | void MainWindow::getFile( bool success ) | 2003 | void 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 | ||
2016 | void MainWindow::printSel( ) | 2016 | void MainWindow::printSel( ) |
2017 | { | 2017 | { |
2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2018 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2019 | } | 2019 | } |
2020 | 2020 | ||
2021 | void MainWindow::printCal() | 2021 | void 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> |
2029 | void MainWindow::weekAction() | 2029 | void 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 | } |