-rw-r--r-- | korganizer/calendarview.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a8ad467..503ef12 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,40 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preston.brown@yale.edu) | 8 | Preston Brown (preton.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
@@ -1630,66 +1630,67 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1630 | return syncOK; | 1630 | return syncOK; |
1631 | 1631 | ||
1632 | 1632 | ||
1633 | #endif | 1633 | #endif |
1634 | 1634 | ||
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | void CalendarView::setSyncEventsReadOnly() | 1637 | void CalendarView::setSyncEventsReadOnly() |
1638 | { | 1638 | { |
1639 | Event * ev; | 1639 | Event * ev; |
1640 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1640 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1641 | ev = eL.first(); | 1641 | ev = eL.first(); |
1642 | while ( ev ) { | 1642 | while ( ev ) { |
1643 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1643 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1644 | ev->setReadOnly( true ); | 1644 | ev->setReadOnly( true ); |
1645 | ev = eL.next(); | 1645 | ev = eL.next(); |
1646 | } | 1646 | } |
1647 | } | 1647 | } |
1648 | bool CalendarView::openCalendar(QString filename, bool merge) | 1648 | bool CalendarView::openCalendar(QString filename, bool merge) |
1649 | { | 1649 | { |
1650 | 1650 | ||
1651 | if (filename.isEmpty()) { | 1651 | if (filename.isEmpty()) { |
1652 | return false; | 1652 | return false; |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | if (!QFile::exists(filename)) { | 1655 | if (!QFile::exists(filename)) { |
1656 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1656 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1657 | return false; | 1657 | return false; |
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | globalFlagBlockAgenda = 1; | 1660 | globalFlagBlockAgenda = 1; |
1661 | if (!merge) { | 1661 | if (!merge) { |
1662 | mCalendar->close(); | ||
1663 | mTodoList->clearList(); | 1662 | mTodoList->clearList(); |
1663 | mViewManager->setDocumentId( filename ); | ||
1664 | mCalendar->close(); | ||
1664 | } | 1665 | } |
1665 | mStorage->setFileName( filename ); | 1666 | mStorage->setFileName( filename ); |
1666 | 1667 | ||
1667 | if ( mStorage->load() ) { | 1668 | if ( mStorage->load() ) { |
1668 | if ( merge ) ;//setModified( true ); | 1669 | if ( merge ) ;//setModified( true ); |
1669 | else { | 1670 | else { |
1670 | //setModified( true ); | 1671 | //setModified( true ); |
1671 | mViewManager->setDocumentId( filename ); | 1672 | mViewManager->setDocumentId( filename ); |
1672 | mDialogManager->setDocumentId( filename ); | 1673 | mDialogManager->setDocumentId( filename ); |
1673 | mTodoList->setDocumentId( filename ); | 1674 | mTodoList->setDocumentId( filename ); |
1674 | } | 1675 | } |
1675 | globalFlagBlockAgenda = 2; | 1676 | globalFlagBlockAgenda = 2; |
1676 | // if ( getLastSyncEvent() ) | 1677 | // if ( getLastSyncEvent() ) |
1677 | // getLastSyncEvent()->setReadOnly( true ); | 1678 | // getLastSyncEvent()->setReadOnly( true ); |
1678 | mCalendar->reInitAlarmSettings(); | 1679 | mCalendar->reInitAlarmSettings(); |
1679 | setSyncEventsReadOnly(); | 1680 | setSyncEventsReadOnly(); |
1680 | updateUnmanagedViews(); | 1681 | updateUnmanagedViews(); |
1681 | updateView(); | 1682 | updateView(); |
1682 | if ( filename != MainWindow::defaultFileName() ) { | 1683 | if ( filename != MainWindow::defaultFileName() ) { |
1683 | saveCalendar( MainWindow::defaultFileName() ); | 1684 | saveCalendar( MainWindow::defaultFileName() ); |
1684 | } else { | 1685 | } else { |
1685 | QFileInfo finf ( MainWindow::defaultFileName()); | 1686 | QFileInfo finf ( MainWindow::defaultFileName()); |
1686 | if ( finf.exists() ) { | 1687 | if ( finf.exists() ) { |
1687 | setLoadedFileVersion( finf.lastModified () ); | 1688 | setLoadedFileVersion( finf.lastModified () ); |
1688 | } | 1689 | } |
1689 | } | 1690 | } |
1690 | return true; | 1691 | return true; |
1691 | } else { | 1692 | } else { |
1692 | // while failing to load, the calendar object could | 1693 | // while failing to load, the calendar object could |
1693 | // have become partially populated. Clear it out. | 1694 | // have become partially populated. Clear it out. |
1694 | if ( !merge ) { | 1695 | if ( !merge ) { |
1695 | mCalendar->close(); | 1696 | mCalendar->close(); |