author | zautrix <zautrix> | 2005-06-15 18:23:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-15 18:23:08 (UTC) |
commit | ccfe3f97afd65c75ee6c7c931cb3694919a4e29b (patch) (unidiff) | |
tree | 117d3467ef1d9678f31dea1b506390707f88d94a /korganizer | |
parent | cba0ac17d3d505805be6aa4b4fea6f63473a1e00 (diff) | |
download | kdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.zip kdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.tar.gz kdepimpi-ccfe3f97afd65c75ee6c7c931cb3694919a4e29b.tar.bz2 |
fixess
-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 68 | ||||
-rw-r--r-- | korganizer/kolistview.h | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 4 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 |
6 files changed, 73 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 377a66f..2012e92 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1804,72 +1804,65 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1804 | if ( loadOk && !todolist.isEmpty() ) | 1804 | if ( loadOk && !todolist.isEmpty() ) |
1805 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1805 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1806 | 1806 | ||
1807 | if ( loadOk ) { | 1807 | if ( loadOk ) { |
1808 | getEventViewerDialog()->setSyncMode( true ); | 1808 | getEventViewerDialog()->setSyncMode( true ); |
1809 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1809 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1810 | getEventViewerDialog()->setSyncMode( false ); | 1810 | getEventViewerDialog()->setSyncMode( false ); |
1811 | qApp->processEvents(); | 1811 | qApp->processEvents(); |
1812 | if ( syncOK ) { | 1812 | if ( syncOK ) { |
1813 | if ( mSyncManager->mWriteBackFile ) | 1813 | if ( mSyncManager->mWriteBackFile ) |
1814 | { | 1814 | { |
1815 | // write back XML file | 1815 | // write back XML file |
1816 | 1816 | ||
1817 | } | 1817 | } |
1818 | setModified( true ); | 1818 | setModified( true ); |
1819 | } | 1819 | } |
1820 | } else { | 1820 | } else { |
1821 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1821 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1822 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1822 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1823 | question, i18n("Ok")) ; | 1823 | question, i18n("Ok")) ; |
1824 | } | 1824 | } |
1825 | delete calendar; | 1825 | delete calendar; |
1826 | updateView(); | 1826 | updateView(); |
1827 | return syncOK; | 1827 | return syncOK; |
1828 | 1828 | ||
1829 | 1829 | ||
1830 | #endif | 1830 | #endif |
1831 | 1831 | ||
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | void CalendarView::setSyncEventsReadOnly() | 1834 | void CalendarView::setSyncEventsReadOnly() |
1835 | { | 1835 | { |
1836 | Event * ev; | 1836 | mCalendar->setSyncEventsReadOnly(); |
1837 | QPtrList<Event> eL = mCalendar->rawEvents(); | ||
1838 | ev = eL.first(); | ||
1839 | while ( ev ) { | ||
1840 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | ||
1841 | ev->setReadOnly( true ); | ||
1842 | ev = eL.next(); | ||
1843 | } | ||
1844 | } | 1837 | } |
1845 | 1838 | ||
1846 | bool CalendarView::loadCalendars() | 1839 | bool CalendarView::loadCalendars() |
1847 | { | 1840 | { |
1848 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1841 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1849 | KopiCalendarFile * cal = calendars.first(); | 1842 | KopiCalendarFile * cal = calendars.first(); |
1850 | mCalendar->setDefaultCalendar( 1 ); | 1843 | mCalendar->setDefaultCalendar( 1 ); |
1851 | openCalendar( MainWindow::defaultFileName(), false ); | 1844 | openCalendar( MainWindow::defaultFileName(), false ); |
1852 | cal = calendars.next(); | 1845 | cal = calendars.next(); |
1853 | while ( cal ) { | 1846 | while ( cal ) { |
1854 | addCalendar( cal ); | 1847 | addCalendar( cal ); |
1855 | cal = calendars.next(); | 1848 | cal = calendars.next(); |
1856 | } | 1849 | } |
1857 | restoreCalendarSettings(); | 1850 | restoreCalendarSettings(); |
1858 | return true; | 1851 | return true; |
1859 | } | 1852 | } |
1860 | bool CalendarView::restoreCalendarSettings() | 1853 | bool CalendarView::restoreCalendarSettings() |
1861 | { | 1854 | { |
1862 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1855 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1863 | KopiCalendarFile * cal = calendars.first(); | 1856 | KopiCalendarFile * cal = calendars.first(); |
1864 | while ( cal ) { | 1857 | while ( cal ) { |
1865 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1858 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1866 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1859 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1867 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1860 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1868 | if ( cal->isStandard ) | 1861 | if ( cal->isStandard ) |
1869 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1862 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1870 | cal = calendars.next(); | 1863 | cal = calendars.next(); |
1871 | } | 1864 | } |
1872 | setSyncEventsReadOnly(); | 1865 | setSyncEventsReadOnly(); |
1873 | mCalendar->reInitAlarmSettings(); | 1866 | mCalendar->reInitAlarmSettings(); |
1874 | updateUnmanagedViews(); | 1867 | updateUnmanagedViews(); |
1875 | updateView(); | 1868 | updateView(); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index b2b136a..93ff55e 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -633,65 +633,65 @@ void KOAgendaView::slotDaylabelClicked( int num ) | |||
633 | else | 633 | else |
634 | emit showDateView( 3, firstDate.addDays( num ) ); | 634 | emit showDateView( 3, firstDate.addDays( num ) ); |
635 | } | 635 | } |
636 | else | 636 | else |
637 | showDateView( 10, firstDate.addDays(1) ); | 637 | showDateView( 10, firstDate.addDays(1) ); |
638 | } | 638 | } |
639 | 639 | ||
640 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 640 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
641 | { | 641 | { |
642 | 642 | ||
643 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 643 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
644 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 644 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
645 | mDayLabelsList.append( dayLabel ); | 645 | mDayLabelsList.append( dayLabel ); |
646 | mLayoutDayLabels->addWidget(dayLabel); | 646 | mLayoutDayLabels->addWidget(dayLabel); |
647 | return dayLabel ; | 647 | return dayLabel ; |
648 | } | 648 | } |
649 | 649 | ||
650 | void KOAgendaView::createDayLabels() | 650 | void KOAgendaView::createDayLabels() |
651 | { | 651 | { |
652 | 652 | ||
653 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 653 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
654 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 654 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
655 | return; | 655 | return; |
656 | 656 | ||
657 | } | 657 | } |
658 | int newHight; | 658 | int newHight; |
659 | if ( !mSelectedDates.count()) | 659 | if ( !mSelectedDates.count()) |
660 | return; | 660 | return; |
661 | 661 | ||
662 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 662 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
663 | // It would remove some flickering and gain speed (since this is called by | 663 | // It would remove some flickering and gain speed (since this is called by |
664 | // each updateView() call) | 664 | // each updateView() call) |
665 | 665 | ||
666 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; | 666 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; |
667 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 667 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
668 | if ( maxWid < 20 ) | 668 | if ( maxWid < 20 ) |
669 | maxWid = 20; | 669 | maxWid = 20; |
670 | 670 | ||
671 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 671 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
672 | QFontMetrics fm ( dlf ); | 672 | QFontMetrics fm ( dlf ); |
673 | int selCount = mSelectedDates.count(); | 673 | int selCount = mSelectedDates.count(); |
674 | int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; | 674 | int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; |
675 | QString dayTest = "Mon 20"; | 675 | QString dayTest = "Mon 20"; |
676 | //QString dayTest = "Mon 20"; | 676 | //QString dayTest = "Mon 20"; |
677 | int wid = fm.width( dayTest ); | 677 | int wid = fm.width( dayTest ); |
678 | //maxWid -= ( selCount * 3 ); //working for QLabels | 678 | //maxWid -= ( selCount * 3 ); //working for QLabels |
679 | if ( QApplication::desktop()->width() <= 320 ) | 679 | if ( QApplication::desktop()->width() <= 320 ) |
680 | maxWid -= ( selCount * 3 ); //working for QPushButton | 680 | maxWid -= ( selCount * 3 ); //working for QPushButton |
681 | else | 681 | else |
682 | maxWid -= ( selCount * 3 ); //working for QPushButton | 682 | maxWid -= ( selCount * 3 ); //working for QPushButton |
683 | if ( maxWid < 0 ) | 683 | if ( maxWid < 0 ) |
684 | maxWid = 20; | 684 | maxWid = 20; |
685 | int needWid = wid * selCount; | 685 | int needWid = wid * selCount; |
686 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 686 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
687 | //if ( needWid > maxWid ) | 687 | //if ( needWid > maxWid ) |
688 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 688 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
689 | while ( needWid > maxWid ) { | 689 | while ( needWid > maxWid ) { |
690 | dayTest = dayTest.left( dayTest.length() - 1 ); | 690 | dayTest = dayTest.left( dayTest.length() - 1 ); |
691 | wid = fm.width( dayTest ); | 691 | wid = fm.width( dayTest ); |
692 | needWid = wid * selCount; | 692 | needWid = wid * selCount; |
693 | } | 693 | } |
694 | int maxLen = dayTest.length(); | 694 | int maxLen = dayTest.length(); |
695 | int fontPoint = dlf.pointSize(); | 695 | int fontPoint = dlf.pointSize(); |
696 | if ( maxLen < 2 ) { | 696 | if ( maxLen < 2 ) { |
697 | int fontPoint = dlf.pointSize(); | 697 | int fontPoint = dlf.pointSize(); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 1f3b4c6..c705c73 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -38,67 +38,64 @@ | |||
38 | #include <qpaintdevicemetrics.h> | 38 | #include <qpaintdevicemetrics.h> |
39 | 39 | ||
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | 44 | ||
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | #include <libkcal/calendar.h> | 46 | #include <libkcal/calendar.h> |
47 | #include <libkcal/calendarlocal.h> | 47 | #include <libkcal/calendarlocal.h> |
48 | #include <libkcal/icalformat.h> | 48 | #include <libkcal/icalformat.h> |
49 | #include <libkcal/vcalformat.h> | 49 | #include <libkcal/vcalformat.h> |
50 | #include <libkcal/recurrence.h> | 50 | #include <libkcal/recurrence.h> |
51 | #include <libkcal/filestorage.h> | 51 | #include <libkcal/filestorage.h> |
52 | #include <libkdepim/categoryselectdialog.h> | 52 | #include <libkdepim/categoryselectdialog.h> |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #else | 56 | #else |
57 | #include <qapplication.h> | 57 | #include <qapplication.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef KORG_NOPRINTER | 60 | #ifndef KORG_NOPRINTER |
61 | #include "calprinter.h" | 61 | #include "calprinter.h" |
62 | #endif | 62 | #endif |
63 | #include "koglobals.h" | 63 | #include "koglobals.h" |
64 | #include "koprefs.h" | 64 | #include "koprefs.h" |
65 | #include "kfiledialog.h" | 65 | #include "kfiledialog.h" |
66 | 66 | ||
67 | #include "kolistview.h" | 67 | #include "kolistview.h" |
68 | #include "koeventviewer.h" | 68 | #include "koeventviewer.h" |
69 | 69 | ||
70 | |||
71 | |||
72 | |||
73 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
74 | { | 71 | { |
75 | public: | 72 | public: |
76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
77 | 74 | ||
78 | protected: | 75 | protected: |
79 | virtual QString text( const QPoint& p) | 76 | virtual QString text( const QPoint& p) |
80 | { | 77 | { |
81 | return _view->getWhatsThisText(p) ; | 78 | return _view->getWhatsThisText(p) ; |
82 | } | 79 | } |
83 | private: | 80 | private: |
84 | QWidget* _wid; | 81 | QWidget* _wid; |
85 | KOListView * _view; | 82 | KOListView * _view; |
86 | }; | 83 | }; |
87 | 84 | ||
88 | 85 | ||
89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
90 | { | 87 | { |
91 | mItem = item; | 88 | mItem = item; |
92 | mDate = date; | 89 | mDate = date; |
93 | } | 90 | } |
94 | 91 | ||
95 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
96 | { | 93 | { |
97 | } | 94 | } |
98 | 95 | ||
99 | bool ListItemVisitor::visit(Event *e) | 96 | bool ListItemVisitor::visit(Event *e) |
100 | { | 97 | { |
101 | bool ok = false; | 98 | bool ok = false; |
102 | QString start, end; | 99 | QString start, end; |
103 | QDate ds, de; | 100 | QDate ds, de; |
104 | if ( e->doesRecur() ) { | 101 | if ( e->doesRecur() ) { |
@@ -111,295 +108,354 @@ bool ListItemVisitor::visit(Event *e) | |||
111 | } | 108 | } |
112 | 109 | ||
113 | } | 110 | } |
114 | if ( ! ok ) { | 111 | if ( ! ok ) { |
115 | start =e->dtStartDateStr(); | 112 | start =e->dtStartDateStr(); |
116 | end = e->dtEndDateStr(); | 113 | end = e->dtEndDateStr(); |
117 | ds = e->dtStart().date(); | 114 | ds = e->dtStart().date(); |
118 | de = e->dtEnd().date(); | 115 | de = e->dtEnd().date(); |
119 | } | 116 | } |
120 | mItem->setText(0,e->summary()); | 117 | mItem->setText(0,e->summary()); |
121 | mItem->setText(1,start); | 118 | mItem->setText(1,start); |
122 | if ( e->doesFloat() ) | 119 | if ( e->doesFloat() ) |
123 | mItem->setText(2,"---"); | 120 | mItem->setText(2,"---"); |
124 | else | 121 | else |
125 | mItem->setText(2,e->dtStartTimeStr()); | 122 | mItem->setText(2,e->dtStartTimeStr()); |
126 | mItem->setText(3,end); | 123 | mItem->setText(3,end); |
127 | if ( e->doesFloat() ) | 124 | if ( e->doesFloat() ) |
128 | mItem->setText(4,"---"); | 125 | mItem->setText(4,"---"); |
129 | else | 126 | else |
130 | mItem->setText(4,e->dtEndTimeStr()); | 127 | mItem->setText(4,e->dtEndTimeStr()); |
131 | if ( e->isAlarmEnabled() ) { | 128 | if ( e->isAlarmEnabled() ) { |
132 | mItem->setText(5,e->alarms().first()->offsetText() ); | 129 | mItem->setText(5,e->alarms().first()->offsetText() ); |
133 | } else { | 130 | } else { |
134 | mItem->setText(5, i18n("No")); | 131 | mItem->setText(5, i18n("No")); |
135 | } | 132 | } |
136 | mItem->setText(6, e->recurrence()->recurrenceText()); | 133 | mItem->setText(6, e->recurrence()->recurrenceText()); |
137 | if( ! e->doesRecur() ) | 134 | if( ! e->doesRecur() ) |
138 | mItem->setSortKey( 6, "-" ); | 135 | mItem->setSortKey( 6, "-" ); |
139 | mItem->setText(7,"---"); | 136 | mItem->setText(7,"---"); |
140 | mItem->setText(8,"---"); | 137 | mItem->setText(8,"---"); |
141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 138 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
142 | mItem->setText(10,e->categoriesStr()); | 139 | mItem->setText(10,e->categoriesStr()); |
140 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | ||
143 | 141 | ||
144 | QString key; | 142 | QString key; |
145 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 143 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
146 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 144 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
147 | mItem->setSortKey(1,key); | 145 | mItem->setSortKey(1,key); |
148 | 146 | ||
149 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 147 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
150 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 148 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
151 | mItem->setSortKey(3,key); | 149 | mItem->setSortKey(3,key); |
152 | return true; | 150 | return true; |
153 | } | 151 | } |
154 | 152 | ||
155 | bool ListItemVisitor::visit(Todo *t) | 153 | bool ListItemVisitor::visit(Todo *t) |
156 | { | 154 | { |
157 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); | 155 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); |
158 | if (t->hasStartDate()) { | 156 | if (t->hasStartDate()) { |
159 | mItem->setText(1,t->dtStartDateStr()); | 157 | mItem->setText(1,t->dtStartDateStr()); |
160 | if (t->doesFloat()) { | 158 | if (t->doesFloat()) { |
161 | mItem->setText(2,"---"); | 159 | mItem->setText(2,"---"); |
162 | } else { | 160 | } else { |
163 | mItem->setText(2,t->dtStartTimeStr()); | 161 | mItem->setText(2,t->dtStartTimeStr()); |
164 | } | 162 | } |
165 | } else { | 163 | } else { |
166 | mItem->setText(1,"---"); | 164 | mItem->setText(1,"---"); |
167 | mItem->setText(2,"---"); | 165 | mItem->setText(2,"---"); |
168 | } | 166 | } |
169 | mItem->setText(3,"---"); | 167 | mItem->setText(3,"---"); |
170 | mItem->setText(4,"---"); | 168 | mItem->setText(4,"---"); |
171 | if ( t->isAlarmEnabled() ) { | 169 | if ( t->isAlarmEnabled() ) { |
172 | mItem->setText(5,t->alarms().first()->offsetText() ); | 170 | mItem->setText(5,t->alarms().first()->offsetText() ); |
173 | } else { | 171 | } else { |
174 | mItem->setText(5, i18n("No")); | 172 | mItem->setText(5, i18n("No")); |
175 | } | 173 | } |
176 | mItem->setText(6, t->recurrence()->recurrenceText()); | 174 | mItem->setText(6, t->recurrence()->recurrenceText()); |
177 | if( ! t->doesRecur() ) | 175 | if( ! t->doesRecur() ) |
178 | mItem->setSortKey( 6, "-" ); | 176 | mItem->setSortKey( 6, "-" ); |
179 | if (t->hasDueDate()) { | 177 | if (t->hasDueDate()) { |
180 | mItem->setText(7,t->dtDueDateStr()); | 178 | mItem->setText(7,t->dtDueDateStr()); |
181 | if (t->doesFloat()) { | 179 | if (t->doesFloat()) { |
182 | mItem->setText(8,"---"); | 180 | mItem->setText(8,"---"); |
183 | } else { | 181 | } else { |
184 | mItem->setText(8,t->dtDueTimeStr()); | 182 | mItem->setText(8,t->dtDueTimeStr()); |
185 | } | 183 | } |
186 | } else { | 184 | } else { |
187 | mItem->setText(7,"---"); | 185 | mItem->setText(7,"---"); |
188 | mItem->setText(8,"---"); | 186 | mItem->setText(8,"---"); |
189 | } | 187 | } |
190 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 188 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
191 | mItem->setText(10,t->categoriesStr()); | 189 | mItem->setText(10,t->categoriesStr()); |
190 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | ||
192 | 191 | ||
193 | QString key; | 192 | QString key; |
194 | QDate d; | 193 | QDate d; |
195 | if (t->hasDueDate()) { | 194 | if (t->hasDueDate()) { |
196 | d = t->dtDue().date(); | 195 | d = t->dtDue().date(); |
197 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 196 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
198 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 197 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
199 | mItem->setSortKey(7,key); | 198 | mItem->setSortKey(7,key); |
200 | } | 199 | } |
201 | if ( t->hasStartDate() ) { | 200 | if ( t->hasStartDate() ) { |
202 | d = t->dtStart().date(); | 201 | d = t->dtStart().date(); |
203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 202 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 203 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
205 | mItem->setSortKey(1,key); | 204 | mItem->setSortKey(1,key); |
206 | } | 205 | } |
207 | return true; | 206 | return true; |
208 | } | 207 | } |
209 | 208 | ||
210 | bool ListItemVisitor::visit(Journal * j) | 209 | bool ListItemVisitor::visit(Journal * j) |
211 | { | 210 | { |
212 | QString des = j->description().left(30); | 211 | QString des = j->description().left(30); |
213 | des = des.simplifyWhiteSpace (); | 212 | des = des.simplifyWhiteSpace (); |
214 | des.replace (QRegExp ("\\n"),"" ); | 213 | des.replace (QRegExp ("\\n"),"" ); |
215 | des.replace (QRegExp ("\\r"),"" ); | 214 | des.replace (QRegExp ("\\r"),"" ); |
216 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 215 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
217 | mItem->setText(1,j->dtStartDateStr()); | 216 | mItem->setText(1,j->dtStartDateStr()); |
218 | mItem->setText(2,"---"); | 217 | mItem->setText(2,"---"); |
219 | mItem->setText(3,"---"); | 218 | mItem->setText(3,"---"); |
220 | mItem->setText(4,"---"); | 219 | mItem->setText(4,"---"); |
221 | mItem->setText(5,"---"); | 220 | mItem->setText(5,"---"); |
222 | mItem->setText(6,"---"); | 221 | mItem->setText(6,"---"); |
223 | mItem->setText(7,j->dtStartDateStr()); | 222 | mItem->setText(7,j->dtStartDateStr()); |
224 | mItem->setText(8,"---"); | 223 | mItem->setText(8,"---"); |
225 | mItem->setText(9,"---"); | 224 | mItem->setText(9,"---"); |
226 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 225 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
226 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | ||
227 | 227 | ||
228 | QString key; | 228 | QString key; |
229 | QDate d = j->dtStart().date(); | 229 | QDate d = j->dtStart().date(); |
230 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 230 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
231 | mItem->setSortKey(1,key); | 231 | mItem->setSortKey(1,key); |
232 | mItem->setSortKey(7,key); | 232 | mItem->setSortKey(7,key); |
233 | 233 | ||
234 | return true; | 234 | return true; |
235 | } | 235 | } |
236 | 236 | ||
237 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 237 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
238 | const char *name) | 238 | const char *name) |
239 | : KOEventView(calendar, parent, name) | 239 | : KOEventView(calendar, parent, name) |
240 | { | 240 | { |
241 | mActiveItem = 0; | 241 | mActiveItem = 0; |
242 | mListView = new KOListViewListView(this); | 242 | mListView = new KOListViewListView(this); |
243 | mListView->addColumn(i18n("Summary")); | 243 | mListView->addColumn(i18n("Summary")); |
244 | mListView->addColumn(i18n("Start Date")); | 244 | mListView->addColumn(i18n("Start Date")); |
245 | mListView->addColumn(i18n("Start Time")); | 245 | mListView->addColumn(i18n("Start Time")); |
246 | mListView->addColumn(i18n("End Date")); | 246 | mListView->addColumn(i18n("End Date")); |
247 | mListView->addColumn(i18n("End Time")); | 247 | mListView->addColumn(i18n("End Time")); |
248 | mListView->addColumn(i18n("Alarm")); // alarm set? | 248 | mListView->addColumn(i18n("Alarm")); // alarm set? |
249 | mListView->addColumn(i18n("Recurs")); // recurs? | 249 | mListView->addColumn(i18n("Recurs")); // recurs? |
250 | mListView->addColumn(i18n("Due Date")); | 250 | mListView->addColumn(i18n("Due Date")); |
251 | mListView->addColumn(i18n("Due Time")); | 251 | mListView->addColumn(i18n("Due Time")); |
252 | mListView->addColumn(i18n("Cancelled")); | 252 | mListView->addColumn(i18n("Cancelled")); |
253 | mListView->addColumn(i18n("Categories")); | 253 | mListView->addColumn(i18n("Categories")); |
254 | mListView->addColumn(i18n("Calendar")); | ||
254 | 255 | ||
255 | mListView->setColumnAlignment(0,AlignLeft); | 256 | mListView->setColumnAlignment(0,AlignLeft); |
256 | mListView->setColumnAlignment(1,AlignLeft); | 257 | mListView->setColumnAlignment(1,AlignLeft); |
257 | mListView->setColumnAlignment(2,AlignHCenter); | 258 | mListView->setColumnAlignment(2,AlignHCenter); |
258 | mListView->setColumnAlignment(3,AlignLeft); | 259 | mListView->setColumnAlignment(3,AlignLeft); |
259 | mListView->setColumnAlignment(4,AlignHCenter); | 260 | mListView->setColumnAlignment(4,AlignHCenter); |
260 | mListView->setColumnAlignment(5,AlignLeft); | 261 | mListView->setColumnAlignment(5,AlignLeft); |
261 | mListView->setColumnAlignment(6,AlignLeft); | 262 | mListView->setColumnAlignment(6,AlignLeft); |
262 | mListView->setColumnAlignment(7,AlignLeft); | 263 | mListView->setColumnAlignment(7,AlignLeft); |
263 | mListView->setColumnAlignment(8,AlignLeft); | 264 | mListView->setColumnAlignment(8,AlignLeft); |
264 | mListView->setColumnAlignment(9,AlignLeft); | 265 | mListView->setColumnAlignment(9,AlignLeft); |
265 | mListView->setColumnAlignment(10,AlignLeft); | 266 | mListView->setColumnAlignment(10,AlignLeft); |
266 | mListView->setColumnWidthMode(10, QListView::Manual); | 267 | mListView->setColumnAlignment(11,AlignLeft); |
267 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 268 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
268 | 269 | ||
269 | int iii = 0; | 270 | int iii = 0; |
270 | for ( iii = 0; iii< 10 ; ++iii ) | 271 | for ( iii = 0; iii< 12 ; ++iii ) |
271 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 272 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
272 | 273 | ||
273 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 274 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
274 | layoutTop->addWidget(mListView); | 275 | layoutTop->addWidget(mListView); |
275 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 276 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
276 | mPopupMenu = eventPopup(); | 277 | mPopupMenu = eventPopup(); |
277 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
278 | i18n("Select all"),this, | 279 | i18n("Select all"),this, |
279 | SLOT(allSelection()),true); | 280 | SLOT(allSelection()),true); |
280 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 281 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
281 | i18n("Deselect all"),this, | 282 | i18n("Deselect all"),this, |
282 | SLOT(clearSelection()),true); | 283 | SLOT(clearSelection()),true); |
283 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 284 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
284 | i18n("Delete all selected"),this, | 285 | i18n("Delete all selected"),this, |
285 | SLOT(deleteAll()),true); | 286 | SLOT(deleteAll()),true); |
286 | 287 | ||
287 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 288 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
288 | i18n("Hide all selected"),this, | 289 | i18n("Hide all selected"),this, |
289 | SLOT(hideAll()),true); | 290 | SLOT(hideAll()),true); |
290 | 291 | ||
291 | mPopupMenu->insertSeparator(); | 292 | mPopupMenu->insertSeparator(); |
292 | #ifdef DESKTOP_VERSION | 293 | #ifdef DESKTOP_VERSION |
293 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 294 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
294 | i18n("Print complete list"),this, | 295 | i18n("Print complete list"),this, |
295 | SLOT(printList()),true); | 296 | SLOT(printList()),true); |
296 | mPopupMenu->insertSeparator(); | 297 | mPopupMenu->insertSeparator(); |
297 | #endif | 298 | #endif |
299 | mCalPopup = new QPopupMenu ( this ); | ||
300 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); | ||
301 | |||
302 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | ||
303 | SLOT( populateCalPopup() )); | ||
304 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | ||
305 | SLOT( setCalendar( int ) )); | ||
298 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 306 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
299 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); | 307 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); |
300 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 308 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
301 | SLOT(saveToFile())); | 309 | SLOT(saveToFile())); |
302 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 310 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
303 | SLOT(saveToFileVCS())); | 311 | SLOT(saveToFileVCS())); |
304 | exportPO->insertItem( i18n("Journal/Details..."),this, | 312 | exportPO->insertItem( i18n("Journal/Details..."),this, |
305 | SLOT(saveDescriptionToFile())); | 313 | SLOT(saveDescriptionToFile())); |
306 | // mPopupMenu->insertSeparator(); | 314 | // mPopupMenu->insertSeparator(); |
307 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 315 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
308 | i18n("Add Categ. to selected..."),this, | 316 | i18n("Add Categ. to selected..."),this, |
309 | SLOT(addCat()),true); | 317 | SLOT(addCat()),true); |
310 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
311 | i18n("Set Categ. for selected..."),this, | 319 | i18n("Set Categ. for selected..."),this, |
312 | SLOT(setCat()),true); | 320 | SLOT(setCat()),true); |
313 | //mPopupMenu->insertSeparator(); | 321 | //mPopupMenu->insertSeparator(); |
314 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 322 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
315 | i18n("Set alarm for selected..."),this, | 323 | i18n("Set alarm for selected..."),this, |
316 | SLOT(setAlarm()),true); | 324 | SLOT(setAlarm()),true); |
317 | 325 | ||
318 | 326 | ||
327 | |||
319 | #ifndef DESKTOP_VERSION | 328 | #ifndef DESKTOP_VERSION |
320 | mPopupMenu->insertSeparator(); | 329 | mPopupMenu->insertSeparator(); |
321 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
322 | i18n("Beam selected via IR"),this, | 331 | i18n("Beam selected via IR"),this, |
323 | SLOT(beamSelected()),true); | 332 | SLOT(beamSelected()),true); |
324 | #endif | 333 | #endif |
325 | /* | 334 | /* |
326 | mPopupMenu = new QPopupMenu; | 335 | mPopupMenu = new QPopupMenu; |
327 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 336 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
328 | SLOT (editEvent())); | 337 | SLOT (editEvent())); |
329 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 338 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
330 | SLOT (deleteEvent())); | 339 | SLOT (deleteEvent())); |
331 | mPopupMenu->insertSeparator(); | 340 | mPopupMenu->insertSeparator(); |
332 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 341 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
333 | SLOT(showDates())); | 342 | SLOT(showDates())); |
334 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 343 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
335 | SLOT(hideDates())); | 344 | SLOT(hideDates())); |
336 | */ | 345 | */ |
337 | QObject::connect(mListView,SIGNAL( newEvent()), | 346 | QObject::connect(mListView,SIGNAL( newEvent()), |
338 | this,SIGNAL(signalNewEvent())); | 347 | this,SIGNAL(signalNewEvent())); |
339 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 348 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
340 | this,SLOT(defaultItemAction(QListViewItem *))); | 349 | this,SLOT(defaultItemAction(QListViewItem *))); |
341 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 350 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
342 | const QPoint &, int )), | 351 | const QPoint &, int )), |
343 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 352 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
344 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 353 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
345 | SLOT(processSelectionChange(QListViewItem *))); | 354 | SLOT(processSelectionChange(QListViewItem *))); |
346 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 355 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
347 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 356 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
348 | 357 | ||
349 | readSettings(KOGlobals::config(),"KOListView Layout"); | 358 | readSettings(KOGlobals::config(),"KOListView Layout"); |
350 | } | 359 | } |
351 | 360 | ||
352 | KOListView::~KOListView() | 361 | KOListView::~KOListView() |
353 | { | 362 | { |
354 | delete mPopupMenu; | 363 | delete mPopupMenu; |
355 | #if QT_VERSION >= 0x030000 | 364 | #if QT_VERSION >= 0x030000 |
356 | 365 | ||
357 | #else | 366 | #else |
358 | delete mKOListViewWhatsThis; | 367 | delete mKOListViewWhatsThis; |
359 | #endif | 368 | #endif |
360 | } | 369 | } |
361 | 370 | ||
362 | QString KOListView::getWhatsThisText(QPoint p) | 371 | QString KOListView::getWhatsThisText(QPoint p) |
363 | { | 372 | { |
364 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 373 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
365 | if ( item ) | 374 | if ( item ) |
366 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 375 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
367 | KOPrefs::instance()->mWTshowDetails, | 376 | KOPrefs::instance()->mWTshowDetails, |
368 | KOPrefs::instance()->mWTshowCreated, | 377 | KOPrefs::instance()->mWTshowCreated, |
369 | KOPrefs::instance()->mWTshowChanged); | 378 | KOPrefs::instance()->mWTshowChanged); |
370 | return i18n("That is the list view" ); | 379 | return i18n("That is the list view" ); |
371 | 380 | ||
372 | } | 381 | } |
373 | 382 | ||
383 | void KOListView::setCalendar( int c ) | ||
384 | { | ||
385 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | ||
386 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | ||
387 | i18n("Continue"), i18n("Cancel"), 0, | ||
388 | 0, 1 ); | ||
389 | if ( result != 0 ) { | ||
390 | return; | ||
391 | } | ||
392 | |||
393 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | ||
394 | int icount = delSel.count(); | ||
395 | if ( icount ) { | ||
396 | Incidence *incidence = delSel.first(); | ||
397 | while ( incidence ) { | ||
398 | incidence->setCalID( c ); | ||
399 | KOListViewItem * item = getItemForEvent( incidence ); | ||
400 | if ( item ) { | ||
401 | ListItemVisitor v(item, mStartDate ); | ||
402 | incidence->accept(v); | ||
403 | } | ||
404 | incidence = delSel.next(); | ||
405 | } | ||
406 | } | ||
407 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | ||
408 | KopiCalendarFile * cal = calendars.first(); | ||
409 | while ( cal ) { | ||
410 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | ||
411 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | ||
412 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | ||
413 | if ( cal->isStandard ) | ||
414 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | ||
415 | cal = calendars.next(); | ||
416 | } | ||
417 | mCalendar->setSyncEventsReadOnly(); | ||
418 | mCalendar->reInitAlarmSettings(); | ||
419 | |||
420 | } | ||
421 | void KOListView::populateCalPopup() | ||
422 | { | ||
423 | mCalPopup->clear(); | ||
424 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
425 | while ( kkf ) { | ||
426 | mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | ||
427 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
428 | } | ||
429 | } | ||
374 | void KOListView::updateList() | 430 | void KOListView::updateList() |
375 | { | 431 | { |
376 | // qDebug(" KOListView::updateList() "); | 432 | // qDebug(" KOListView::updateList() "); |
377 | 433 | ||
378 | } | 434 | } |
379 | 435 | ||
380 | void KOListView::clearList() | 436 | void KOListView::clearList() |
381 | { | 437 | { |
382 | clear (); | 438 | clear (); |
383 | } | 439 | } |
384 | void KOListView::addCat( ) | 440 | void KOListView::addCat( ) |
385 | { | 441 | { |
386 | setCategories( false ); | 442 | setCategories( false ); |
387 | } | 443 | } |
388 | void KOListView::setCat() | 444 | void KOListView::setCat() |
389 | { | 445 | { |
390 | setCategories( true ); | 446 | setCategories( true ); |
391 | } | 447 | } |
392 | 448 | ||
393 | void KOListView::setAlarm() | 449 | void KOListView::setAlarm() |
394 | { | 450 | { |
395 | KOAlarmPrefs kap( this); | 451 | KOAlarmPrefs kap( this); |
396 | if ( !kap.exec() ) | 452 | if ( !kap.exec() ) |
397 | return; | 453 | return; |
398 | QStringList itemList; | 454 | QStringList itemList; |
399 | QPtrList<KOListViewItem> sel ; | 455 | QPtrList<KOListViewItem> sel ; |
400 | QListViewItem *qitem = mListView->firstChild (); | 456 | QListViewItem *qitem = mListView->firstChild (); |
401 | while ( qitem ) { | 457 | while ( qitem ) { |
402 | if ( qitem->isSelected() ) { | 458 | if ( qitem->isSelected() ) { |
403 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 459 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
404 | if ( inc->typeID() != journalID ) { | 460 | if ( inc->typeID() != journalID ) { |
405 | if ( inc->typeID() == todoID ) { | 461 | if ( inc->typeID() == todoID ) { |
@@ -1010,65 +1066,65 @@ int KOListView::count() | |||
1010 | { | 1066 | { |
1011 | return mListView->childCount(); | 1067 | return mListView->childCount(); |
1012 | } | 1068 | } |
1013 | 1069 | ||
1014 | void KOListView::changeEventDisplay(Event *event, int action) | 1070 | void KOListView::changeEventDisplay(Event *event, int action) |
1015 | { | 1071 | { |
1016 | KOListViewItem *item; | 1072 | KOListViewItem *item; |
1017 | 1073 | ||
1018 | switch(action) { | 1074 | switch(action) { |
1019 | case KOGlobals::EVENTADDED: | 1075 | case KOGlobals::EVENTADDED: |
1020 | addIncidence( event ); | 1076 | addIncidence( event ); |
1021 | break; | 1077 | break; |
1022 | case KOGlobals::EVENTEDITED: | 1078 | case KOGlobals::EVENTEDITED: |
1023 | item = getItemForEvent(event); | 1079 | item = getItemForEvent(event); |
1024 | if (item) { | 1080 | if (item) { |
1025 | mUidDict.remove( event->uid() ); | 1081 | mUidDict.remove( event->uid() ); |
1026 | delete item; | 1082 | delete item; |
1027 | addIncidence( event ); | 1083 | addIncidence( event ); |
1028 | } | 1084 | } |
1029 | break; | 1085 | break; |
1030 | case KOGlobals::EVENTDELETED: | 1086 | case KOGlobals::EVENTDELETED: |
1031 | item = getItemForEvent(event); | 1087 | item = getItemForEvent(event); |
1032 | if (item) { | 1088 | if (item) { |
1033 | mUidDict.remove( event->uid() ); | 1089 | mUidDict.remove( event->uid() ); |
1034 | delete item; | 1090 | delete item; |
1035 | } | 1091 | } |
1036 | break; | 1092 | break; |
1037 | default: | 1093 | default: |
1038 | ; | 1094 | ; |
1039 | } | 1095 | } |
1040 | } | 1096 | } |
1041 | 1097 | ||
1042 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 1098 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1043 | { | 1099 | { |
1044 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1100 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1045 | while (item) { | 1101 | while (item) { |
1046 | if (item->data() == event) return item; | 1102 | if (item->data() == event) return item; |
1047 | item = (KOListViewItem *)item->nextSibling(); | 1103 | item = (KOListViewItem *)item->nextSibling(); |
1048 | } | 1104 | } |
1049 | return 0; | 1105 | return 0; |
1050 | } | 1106 | } |
1051 | 1107 | ||
1052 | void KOListView::defaultItemAction(QListViewItem *i) | 1108 | void KOListView::defaultItemAction(QListViewItem *i) |
1053 | { | 1109 | { |
1054 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1110 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1055 | if ( item ) defaultAction( item->data() ); | 1111 | if ( item ) defaultAction( item->data() ); |
1056 | 1112 | ||
1057 | } | 1113 | } |
1058 | 1114 | ||
1059 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1115 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
1060 | { | 1116 | { |
1061 | mActiveItem = (KOListViewItem *)item; | 1117 | mActiveItem = (KOListViewItem *)item; |
1062 | if (mActiveItem) { | 1118 | if (mActiveItem) { |
1063 | Incidence *incidence = mActiveItem->data(); | 1119 | Incidence *incidence = mActiveItem->data(); |
1064 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1120 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1065 | mPopupMenu->showIncidencePopup(incidence); | 1121 | mPopupMenu->showIncidencePopup(incidence); |
1066 | 1122 | ||
1067 | /* | 1123 | /* |
1068 | if ( incidence && incidence->type() == "Event" ) { | 1124 | if ( incidence && incidence->type() == "Event" ) { |
1069 | Event *event = static_cast<Event *>( incidence ); | 1125 | Event *event = static_cast<Event *>( incidence ); |
1070 | mPopupMenu->showEventPopup(event); | 1126 | mPopupMenu->showEventPopup(event); |
1071 | } | 1127 | } |
1072 | */ | 1128 | */ |
1073 | } | 1129 | } |
1074 | } | 1130 | } |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index 9da5497..d384af0 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -266,53 +266,56 @@ class KOListView : public KOEventView | |||
266 | signals: | 266 | signals: |
267 | void signalNewEvent(); | 267 | void signalNewEvent(); |
268 | void beamIncidenceList(QPtrList<Incidence>); | 268 | void beamIncidenceList(QPtrList<Incidence>); |
269 | 269 | ||
270 | public slots: | 270 | public slots: |
271 | void hideAll(); | 271 | void hideAll(); |
272 | void printList(); | 272 | void printList(); |
273 | void resetFocus(); | 273 | void resetFocus(); |
274 | virtual void updateView(); | 274 | virtual void updateView(); |
275 | virtual void showDates(const QDate &start, const QDate &end); | 275 | virtual void showDates(const QDate &start, const QDate &end); |
276 | virtual void showEvents(QPtrList<Event> eventList); | 276 | virtual void showEvents(QPtrList<Event> eventList); |
277 | void clearSelection(); | 277 | void clearSelection(); |
278 | void allSelection(); | 278 | void allSelection(); |
279 | 279 | ||
280 | void clear(); | 280 | void clear(); |
281 | void beamDone( Ir *ir ); | 281 | void beamDone( Ir *ir ); |
282 | void showDates(); | 282 | void showDates(); |
283 | void hideDates(); | 283 | void hideDates(); |
284 | void deleteAll(); | 284 | void deleteAll(); |
285 | void saveToFile(); | 285 | void saveToFile(); |
286 | void saveToFileVCS(); | 286 | void saveToFileVCS(); |
287 | void saveDescriptionToFile(); | 287 | void saveDescriptionToFile(); |
288 | void beamSelected(); | 288 | void beamSelected(); |
289 | void updateConfig(); | 289 | void updateConfig(); |
290 | void addCat(); | 290 | void addCat(); |
291 | void setCat(); | 291 | void setCat(); |
292 | void setAlarm(); | 292 | void setAlarm(); |
293 | void setCategories( bool removeOld ); | 293 | void setCategories( bool removeOld ); |
294 | void changeEventDisplay(Event *, int); | 294 | void changeEventDisplay(Event *, int); |
295 | 295 | ||
296 | void defaultItemAction(QListViewItem *item); | 296 | void defaultItemAction(QListViewItem *item); |
297 | void popupMenu(QListViewItem *item,const QPoint &,int); | 297 | void popupMenu(QListViewItem *item,const QPoint &,int); |
298 | void setCalendar( int c ); | ||
299 | void populateCalPopup(); | ||
298 | 300 | ||
299 | protected slots: | 301 | protected slots: |
300 | void processSelectionChange(QListViewItem *); | 302 | void processSelectionChange(QListViewItem *); |
301 | 303 | ||
302 | protected: | 304 | protected: |
303 | void writeToFile( bool iCal ); | 305 | void writeToFile( bool iCal ); |
304 | void addEvents(QPtrList<Event> eventList); | 306 | void addEvents(QPtrList<Event> eventList); |
305 | void addIncidence(Incidence *); | 307 | void addIncidence(Incidence *); |
306 | KOListViewItem *getItemForEvent(Event *event); | 308 | KOListViewItem *getItemForEvent(Incidence *event); |
307 | 309 | ||
308 | private: | 310 | private: |
311 | QPopupMenu* mCalPopup; | ||
309 | KOListViewWhatsThis *mKOListViewWhatsThis; | 312 | KOListViewWhatsThis *mKOListViewWhatsThis; |
310 | KOListViewListView *mListView; | 313 | KOListViewListView *mListView; |
311 | KOEventPopupMenu *mPopupMenu; | 314 | KOEventPopupMenu *mPopupMenu; |
312 | KOListViewItem *mActiveItem; | 315 | KOListViewItem *mActiveItem; |
313 | QDict<Incidence> mUidDict; | 316 | QDict<Incidence> mUidDict; |
314 | QDate mStartDate; | 317 | QDate mStartDate; |
315 | void keyPressEvent ( QKeyEvent * ) ; | 318 | void keyPressEvent ( QKeyEvent * ) ; |
316 | }; | 319 | }; |
317 | 320 | ||
318 | #endif | 321 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 65f0342..a4ea3d3 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -466,64 +466,68 @@ void KOPrefs::usrReadConfig() | |||
466 | } | 466 | } |
467 | 467 | ||
468 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 468 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
469 | { | 469 | { |
470 | return mDefCalColors[num-1]; | 470 | return mDefCalColors[num-1]; |
471 | } | 471 | } |
472 | 472 | ||
473 | KopiCalendarFile * KOPrefs::getNewCalendar() | 473 | KopiCalendarFile * KOPrefs::getNewCalendar() |
474 | { | 474 | { |
475 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 475 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
476 | kkf->mCalNumber = mNextAvailableCalendar; | 476 | kkf->mCalNumber = mNextAvailableCalendar; |
477 | mDefCalColors.resize( mNextAvailableCalendar ); | 477 | mDefCalColors.resize( mNextAvailableCalendar ); |
478 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 478 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
479 | ++mNextAvailableCalendar; | 479 | ++mNextAvailableCalendar; |
480 | kkf->mDefaultColor = mEventColor; | 480 | kkf->mDefaultColor = mEventColor; |
481 | kkf->mName = i18n("New Calendar"); | 481 | kkf->mName = i18n("New Calendar"); |
482 | mCalendars.append( kkf ); | 482 | mCalendars.append( kkf ); |
483 | return kkf; | 483 | return kkf; |
484 | } | 484 | } |
485 | void KOPrefs::deleteCalendar( int num ) | 485 | void KOPrefs::deleteCalendar( int num ) |
486 | { | 486 | { |
487 | KopiCalendarFile * kkf = mCalendars.first(); | 487 | KopiCalendarFile * kkf = mCalendars.first(); |
488 | while ( kkf ) { | 488 | while ( kkf ) { |
489 | if ( kkf->mCalNumber == num ) { | 489 | if ( kkf->mCalNumber == num ) { |
490 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 490 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
491 | mCalendars.remove( kkf ); | 491 | mCalendars.remove( kkf ); |
492 | delete kkf; | 492 | delete kkf; |
493 | return; | 493 | return; |
494 | } | 494 | } |
495 | kkf = mCalendars.next(); | 495 | kkf = mCalendars.next(); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | QString KOPrefs::calName( int calNum) const | ||
499 | { | ||
500 | return (mDefCalColors[calNum-1])->mName; | ||
501 | } | ||
498 | QColor KOPrefs::defaultColor( int calNum ) const | 502 | QColor KOPrefs::defaultColor( int calNum ) const |
499 | { | 503 | { |
500 | if ( calNum == 1 ) return mEventColor; | 504 | if ( calNum == 1 ) return mEventColor; |
501 | return (mDefCalColors[calNum-1])->mDefaultColor; | 505 | return (mDefCalColors[calNum-1])->mDefaultColor; |
502 | } | 506 | } |
503 | void KOPrefs::usrWriteConfig() | 507 | void KOPrefs::usrWriteConfig() |
504 | { | 508 | { |
505 | config()->setGroup("General"); | 509 | config()->setGroup("General"); |
506 | config()->writeEntry("Custom Categories",mCustomCategories); | 510 | config()->writeEntry("Custom Categories",mCustomCategories); |
507 | 511 | ||
508 | config()->setGroup("Personal Settings"); | 512 | config()->setGroup("Personal Settings"); |
509 | config()->writeEntry("user_name",mName); | 513 | config()->writeEntry("user_name",mName); |
510 | config()->writeEntry("user_email",mEmail); | 514 | config()->writeEntry("user_email",mEmail); |
511 | 515 | ||
512 | config()->setGroup("Category Colors"); | 516 | config()->setGroup("Category Colors"); |
513 | QDictIterator<QColor> it(mCategoryColors); | 517 | QDictIterator<QColor> it(mCategoryColors); |
514 | while (it.current()) { | 518 | while (it.current()) { |
515 | config()->writeEntry(it.currentKey(),*(it.current())); | 519 | config()->writeEntry(it.currentKey(),*(it.current())); |
516 | ++it; | 520 | ++it; |
517 | } | 521 | } |
518 | KConfig fc (locateLocal("config","kopicalendarrc")); | 522 | KConfig fc (locateLocal("config","kopicalendarrc")); |
519 | fc.setGroup("CC"); | 523 | fc.setGroup("CC"); |
520 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 524 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
521 | int numCal = 1; | 525 | int numCal = 1; |
522 | int writeCal = 0; | 526 | int writeCal = 0; |
523 | while ( numCal < mNextAvailableCalendar ) { | 527 | while ( numCal < mNextAvailableCalendar ) { |
524 | KopiCalendarFile * kkf = mCalendars.first(); | 528 | KopiCalendarFile * kkf = mCalendars.first(); |
525 | while ( kkf ) { | 529 | while ( kkf ) { |
526 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 530 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |
527 | if ( kkf->mCalNumber == numCal ) { | 531 | if ( kkf->mCalNumber == numCal ) { |
528 | ++writeCal; | 532 | ++writeCal; |
529 | //qDebug("Write calendar %d %d ", numCal , writeCal); | 533 | //qDebug("Write calendar %d %d ", numCal , writeCal); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 463fc33..5cc9bfa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -70,64 +70,65 @@ class KopiCalendarFile : public QObject | |||
70 | QDateTime mLoadDt; | 70 | QDateTime mLoadDt; |
71 | }; | 71 | }; |
72 | class KOPrefs : public KPimPrefs | 72 | class KOPrefs : public KPimPrefs |
73 | { | 73 | { |
74 | public: | 74 | public: |
75 | enum { FormatVCalendar, FormatICalendar }; | 75 | enum { FormatVCalendar, FormatICalendar }; |
76 | enum { MailClientKMail, MailClientSendmail }; | 76 | enum { MailClientKMail, MailClientSendmail }; |
77 | enum { IMIPDummy, IMIPKMail }; | 77 | enum { IMIPDummy, IMIPKMail }; |
78 | enum { IMIPOutbox, IMIPdirectsend }; | 78 | enum { IMIPOutbox, IMIPdirectsend }; |
79 | enum { neverAuto, addressbookAuto, selectedAuto }; | 79 | enum { neverAuto, addressbookAuto, selectedAuto }; |
80 | enum { standardDestination, askDestination }; | 80 | enum { standardDestination, askDestination }; |
81 | 81 | ||
82 | virtual ~KOPrefs(); | 82 | virtual ~KOPrefs(); |
83 | 83 | ||
84 | /** Get instance of KOPrefs. It is made sure that there is only one | 84 | /** Get instance of KOPrefs. It is made sure that there is only one |
85 | instance. */ | 85 | instance. */ |
86 | static KOPrefs *instance(); | 86 | static KOPrefs *instance(); |
87 | 87 | ||
88 | /** Set preferences to default values */ | 88 | /** Set preferences to default values */ |
89 | void usrSetDefaults(); | 89 | void usrSetDefaults(); |
90 | 90 | ||
91 | /** Read preferences from config file */ | 91 | /** Read preferences from config file */ |
92 | void usrReadConfig(); | 92 | void usrReadConfig(); |
93 | 93 | ||
94 | /** Write preferences to config file */ | 94 | /** Write preferences to config file */ |
95 | void usrWriteConfig(); | 95 | void usrWriteConfig(); |
96 | void setCategoryDefaults(); | 96 | void setCategoryDefaults(); |
97 | void setAllDefaults(); | 97 | void setAllDefaults(); |
98 | KopiCalendarFile * getNewCalendar(); | 98 | KopiCalendarFile * getNewCalendar(); |
99 | KopiCalendarFile * getCalendar( int ); | 99 | KopiCalendarFile * getCalendar( int ); |
100 | void deleteCalendar( int ); | 100 | void deleteCalendar( int ); |
101 | QColor defaultColor( int ) const; | 101 | QColor defaultColor( int ) const; |
102 | QString calName( int ) const; | ||
102 | protected: | 103 | protected: |
103 | void setTimeZoneIdDefault(); | 104 | void setTimeZoneIdDefault(); |
104 | 105 | ||
105 | /** Fill empty mail fields with default values. */ | 106 | /** Fill empty mail fields with default values. */ |
106 | void fillMailDefaults(); | 107 | void fillMailDefaults(); |
107 | 108 | ||
108 | private: | 109 | private: |
109 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 110 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
110 | object. */ | 111 | object. */ |
111 | KOPrefs(); | 112 | KOPrefs(); |
112 | 113 | ||
113 | static KOPrefs *mInstance; | 114 | static KOPrefs *mInstance; |
114 | QStringList getDefaultList(); | 115 | QStringList getDefaultList(); |
115 | QStringList getLocationDefaultList(); | 116 | QStringList getLocationDefaultList(); |
116 | public: | 117 | public: |
117 | // preferences data | 118 | // preferences data |
118 | KConfig* getConfig(); | 119 | KConfig* getConfig(); |
119 | void setFullName(const QString &); | 120 | void setFullName(const QString &); |
120 | QString fullName(); | 121 | QString fullName(); |
121 | void setEmail(const QString &); | 122 | void setEmail(const QString &); |
122 | QString email(); | 123 | QString email(); |
123 | 124 | ||
124 | QString mAdditional; | 125 | QString mAdditional; |
125 | 126 | ||
126 | bool mEmailControlCenter; | 127 | bool mEmailControlCenter; |
127 | 128 | ||
128 | bool mBcc; | 129 | bool mBcc; |
129 | bool mAutoSave; | 130 | bool mAutoSave; |
130 | int mAutoSaveInterval; | 131 | int mAutoSaveInterval; |
131 | bool mConfirm; | 132 | bool mConfirm; |
132 | 133 | ||
133 | bool mEnableGroupScheduling; | 134 | bool mEnableGroupScheduling; |