summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d0de233..c0f3be7 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -71,96 +71,97 @@
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 110#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 111#include "statusdialog.h"
112#include "kdatenavigator.h" 112#include "kdatenavigator.h"
113#include "kotodoview.h" 113#include "kotodoview.h"
114#include "datenavigator.h" 114#include "datenavigator.h"
115#include "resourceview.h" 115#include "resourceview.h"
116#include "navigatorbar.h" 116#include "navigatorbar.h"
117#include "searchdialog.h" 117#include "searchdialog.h"
118#include "mainwindow.h" 118#include "mainwindow.h"
119#include "categoryeditdialog.h"
119 120
120#include "calendarview.h" 121#include "calendarview.h"
121#ifndef DESKTOP_VERSION 122#ifndef DESKTOP_VERSION
122#include <qtopia/alarmserver.h> 123#include <qtopia/alarmserver.h>
123#endif 124#endif
124#ifndef _WIN32_ 125#ifndef _WIN32_
125#include <stdlib.h> 126#include <stdlib.h>
126#include <stdio.h> 127#include <stdio.h>
127#include <unistd.h> 128#include <unistd.h>
128#else 129#else
129#include <qprocess.h> 130#include <qprocess.h>
130#endif 131#endif
131 132
132#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
133#include <kabc/stdaddressbook.h> 134#include <kabc/stdaddressbook.h>
134#endif 135#endif
135using namespace KOrg; 136using namespace KOrg;
136using namespace KCal; 137using namespace KCal;
137extern int globalFlagBlockAgenda; 138extern int globalFlagBlockAgenda;
138extern int globalFlagBlockStartup; 139extern int globalFlagBlockStartup;
139 140
140 141
141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 142MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
142 143
143{ 144{
144 mAlarms = alarms; 145 mAlarms = alarms;
145 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 146 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
146 QString mText = "<table width=\"100%\">\n"; 147 QString mText = "<table width=\"100%\">\n";
147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
148#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
150#else 151#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
152#endif 153#endif
153 // mText += "<img src=\""; 154 // mText += "<img src=\"";
154 // mText += ipath; 155 // mText += ipath;
155 // mText += "\">"; 156 // mText += "\">";
156 //mEventDate = QDate::currentDate(); 157 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 159 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
159#else 160#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 161 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
161#endif 162#endif
162 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 163 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163 164
164 Incidence * inc = getNextInc( start ); 165 Incidence * inc = getNextInc( start );
165 int time = 0; 166 int time = 0;
166 //mText += "<table>"; 167 //mText += "<table>";
@@ -268,105 +269,105 @@ void MissedAlarmTextBrowser::setSource(const QString & n)
268} 269}
269 270
270 271
271class KOBeamPrefs : public QDialog 272class KOBeamPrefs : public QDialog
272{ 273{
273 public: 274 public:
274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 275 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
275 QDialog( parent, name, true ) 276 QDialog( parent, name, true )
276 { 277 {
277 setCaption( i18n("Beam Options") ); 278 setCaption( i18n("Beam Options") );
278 QVBoxLayout* lay = new QVBoxLayout( this ); 279 QVBoxLayout* lay = new QVBoxLayout( this );
279 lay->setSpacing( 3 ); 280 lay->setSpacing( 3 );
280 lay->setMargin( 3 ); 281 lay->setMargin( 3 );
281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 282 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
282 lay->addWidget( format ); 283 lay->addWidget( format );
283 format->setExclusive ( true ) ; 284 format->setExclusive ( true ) ;
284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 285 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
285 lay->addWidget( time ); time->setExclusive ( true ) ; 286 lay->addWidget( time ); time->setExclusive ( true ) ;
286 vcal = new QRadioButton(" vCalendar ", format ); 287 vcal = new QRadioButton(" vCalendar ", format );
287 ical = new QRadioButton(" iCalendar ", format ); 288 ical = new QRadioButton(" iCalendar ", format );
288 vcal->setChecked( true ); 289 vcal->setChecked( true );
289 tz = new QRadioButton(i18n(" With timezone "), time ); 290 tz = new QRadioButton(i18n(" With timezone "), time );
290 local = new QRadioButton(i18n(" Local time "), time ); 291 local = new QRadioButton(i18n(" Local time "), time );
291 tz->setChecked( true ); 292 tz->setChecked( true );
292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 293 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
293 lay->addWidget( ok ); 294 lay->addWidget( ok );
294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 295 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
295 lay->addWidget( cancel ); 296 lay->addWidget( cancel );
296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 297 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 298 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
298 resize( 200, 200 ); 299 resize( 200, 200 );
299 } 300 }
300 301
301 bool beamVcal() { return vcal->isChecked(); } 302 bool beamVcal() { return vcal->isChecked(); }
302 bool beamLocal() { return local->isChecked(); } 303 bool beamLocal() { return local->isChecked(); }
303private: 304private:
304 QRadioButton* vcal, *ical, *local, *tz; 305 QRadioButton* vcal, *ical, *local, *tz;
305}; 306};
306class KOCatPrefs : public QDialog 307class KOCatPrefs : public QDialog
307{ 308{
308 public: 309 public:
309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 310 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
310 QDialog( parent, name, true ) 311 QDialog( parent, name, true )
311 { 312 {
312 setCaption( i18n("Manage new Categories") ); 313 setCaption( i18n("Manage new Categories") );
313 QVBoxLayout* lay = new QVBoxLayout( this ); 314 QVBoxLayout* lay = new QVBoxLayout( this );
314 lay->setSpacing( 3 ); 315 lay->setSpacing( 3 );
315 lay->setMargin( 3 ); 316 lay->setMargin( 3 );
316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 317 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
317 lay->addWidget( lab ); 318 lay->addWidget( lab );
318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 319 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
319 lay->addWidget( format ); 320 lay->addWidget( format );
320 format->setExclusive ( true ) ; 321 format->setExclusive ( true ) ;
321 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 322 addCatBut = new QRadioButton(i18n("Add to category list"), format );
322 new QRadioButton(i18n("Remove from Events/Todos"), format ); 323 new QRadioButton(i18n("Remove from Events/Todos"), format );
323 addCatBut->setChecked( true ); 324 addCatBut->setChecked( true );
324 QPushButton * ok = new QPushButton( i18n("OK"), this ); 325 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
325 lay->addWidget( ok ); 326 lay->addWidget( ok );
326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 327 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
327 lay->addWidget( cancel ); 328 lay->addWidget( cancel );
328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 329 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 330 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
330 resize( 200, 200 ); 331 resize( 200, 200 );
331 } 332 }
332 333
333 bool addCat() { return addCatBut->isChecked(); } 334 bool addCat() { return addCatBut->isChecked(); }
334private: 335private:
335 QRadioButton* addCatBut; 336 QRadioButton* addCatBut;
336}; 337};
337 338
338 339
339 340
340CalendarView::CalendarView( CalendarResources *calendar, 341CalendarView::CalendarView( CalendarResources *calendar,
341 QWidget *parent, const char *name ) 342 QWidget *parent, const char *name )
342 : CalendarViewBase( parent, name ), 343 : CalendarViewBase( parent, name ),
343 mCalendar( calendar ), 344 mCalendar( calendar ),
344 mResourceManager( calendar->resourceManager() ) 345 mResourceManager( calendar->resourceManager() )
345{ 346{
346 347
347 mEventEditor = 0; 348 mEventEditor = 0;
348 mTodoEditor = 0; 349 mTodoEditor = 0;
349 350
350 init(); 351 init();
351} 352}
352 353
353CalendarView::CalendarView( Calendar *calendar, 354CalendarView::CalendarView( Calendar *calendar,
354 QWidget *parent, const char *name ) 355 QWidget *parent, const char *name )
355 : CalendarViewBase( parent, name ), 356 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 357 mCalendar( calendar ),
357 mResourceManager( 0 ) 358 mResourceManager( 0 )
358{ 359{
359 360
360 mEventEditor = 0; 361 mEventEditor = 0;
361 mTodoEditor = 0; 362 mTodoEditor = 0;
362 init(); 363 init();
363} 364}
364 365
365void CalendarView::init() 366void CalendarView::init()
366{ 367{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 368 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 369 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 370 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 371 mBlockShowDates = false;
371 372
372 mDatePickerMode = 0; 373 mDatePickerMode = 0;
@@ -2773,96 +2774,102 @@ void CalendarView::slotSelectPickerDate( QDate d)
2773} 2774}
2774 2775
2775void CalendarView::removeCategories() 2776void CalendarView::removeCategories()
2776{ 2777{
2777 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2778 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2778 QStringList catList = KOPrefs::instance()->mCustomCategories; 2779 QStringList catList = KOPrefs::instance()->mCustomCategories;
2779 QStringList catIncList; 2780 QStringList catIncList;
2780 QStringList newCatList; 2781 QStringList newCatList;
2781 Incidence* inc = incList.first(); 2782 Incidence* inc = incList.first();
2782 int i; 2783 int i;
2783 int count = 0; 2784 int count = 0;
2784 while ( inc ) { 2785 while ( inc ) {
2785 newCatList.clear(); 2786 newCatList.clear();
2786 catIncList = inc->categories() ; 2787 catIncList = inc->categories() ;
2787 for( i = 0; i< catIncList.count(); ++i ) { 2788 for( i = 0; i< catIncList.count(); ++i ) {
2788 if ( catList.contains (catIncList[i])) 2789 if ( catList.contains (catIncList[i]))
2789 newCatList.append( catIncList[i] ); 2790 newCatList.append( catIncList[i] );
2790 } 2791 }
2791 newCatList.sort(); 2792 newCatList.sort();
2792 inc->setCategories( newCatList.join(",") ); 2793 inc->setCategories( newCatList.join(",") );
2793 inc = incList.next(); 2794 inc = incList.next();
2794 } 2795 }
2795} 2796}
2796 2797
2797int CalendarView::addCategories() 2798int CalendarView::addCategories()
2798{ 2799{
2799 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2800 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2800 QStringList catList = KOPrefs::instance()->mCustomCategories; 2801 QStringList catList = KOPrefs::instance()->mCustomCategories;
2801 QStringList catIncList; 2802 QStringList catIncList;
2802 Incidence* inc = incList.first(); 2803 Incidence* inc = incList.first();
2803 int i; 2804 int i;
2804 int count = 0; 2805 int count = 0;
2805 while ( inc ) { 2806 while ( inc ) {
2806 catIncList = inc->categories() ; 2807 catIncList = inc->categories() ;
2807 for( i = 0; i< catIncList.count(); ++i ) { 2808 for( i = 0; i< catIncList.count(); ++i ) {
2808 if ( !catList.contains (catIncList[i])) { 2809 if ( !catList.contains (catIncList[i])) {
2809 catList.append( catIncList[i] ); 2810 catList.append( catIncList[i] );
2810 //qDebug("add cat %s ", catIncList[i].latin1()); 2811 //qDebug("add cat %s ", catIncList[i].latin1());
2811 ++count; 2812 ++count;
2812 } 2813 }
2813 } 2814 }
2814 inc = incList.next(); 2815 inc = incList.next();
2815 } 2816 }
2816 catList.sort(); 2817 catList.sort();
2817 KOPrefs::instance()->mCustomCategories = catList; 2818 KOPrefs::instance()->mCustomCategories = catList;
2818 return count; 2819 return count;
2819} 2820}
2820 2821
2822void CalendarView::editCategories()
2823{
2824 qDebug("CalendarView::editCategories() ");
2825 KPIM::CategoryEditDialog ced (KOPrefs::instance(),this );
2826 ced.exec();
2827}
2821void CalendarView::manageCategories() 2828void CalendarView::manageCategories()
2822{ 2829{
2823 KOCatPrefs* cp = new KOCatPrefs(); 2830 KOCatPrefs* cp = new KOCatPrefs();
2824 cp->show(); 2831 cp->show();
2825 int w =cp->sizeHint().width() ; 2832 int w =cp->sizeHint().width() ;
2826 int h = cp->sizeHint().height() ; 2833 int h = cp->sizeHint().height() ;
2827 int dw = QApplication::desktop()->width(); 2834 int dw = QApplication::desktop()->width();
2828 int dh = QApplication::desktop()->height(); 2835 int dh = QApplication::desktop()->height();
2829 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2836 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2830 if ( !cp->exec() ) { 2837 if ( !cp->exec() ) {
2831 delete cp; 2838 delete cp;
2832 return; 2839 return;
2833 } 2840 }
2834 int count = 0; 2841 int count = 0;
2835 if ( cp->addCat() ) { 2842 if ( cp->addCat() ) {
2836 count = addCategories(); 2843 count = addCategories();
2837 if ( count ) { 2844 if ( count ) {
2838 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2845 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2839 writeSettings(); 2846 writeSettings();
2840 } else 2847 } else
2841 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2848 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2842 } else { 2849 } else {
2843 removeCategories(); 2850 removeCategories();
2844 updateView(); 2851 updateView();
2845 } 2852 }
2846 delete cp; 2853 delete cp;
2847} 2854}
2848 2855
2849void CalendarView::beamIncidence(Incidence * Inc) 2856void CalendarView::beamIncidence(Incidence * Inc)
2850{ 2857{
2851 QPtrList<Incidence> delSel ; 2858 QPtrList<Incidence> delSel ;
2852 delSel.append(Inc); 2859 delSel.append(Inc);
2853 beamIncidenceList( delSel ); 2860 beamIncidenceList( delSel );
2854} 2861}
2855void CalendarView::beamCalendar() 2862void CalendarView::beamCalendar()
2856{ 2863{
2857 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2864 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2858 //qDebug("beamCalendar() "); 2865 //qDebug("beamCalendar() ");
2859 beamIncidenceList( delSel ); 2866 beamIncidenceList( delSel );
2860} 2867}
2861void CalendarView::beamFilteredCalendar() 2868void CalendarView::beamFilteredCalendar()
2862{ 2869{
2863 QPtrList<Incidence> delSel = mCalendar->incidences(); 2870 QPtrList<Incidence> delSel = mCalendar->incidences();
2864 //qDebug("beamFilteredCalendar() "); 2871 //qDebug("beamFilteredCalendar() ");
2865 beamIncidenceList( delSel ); 2872 beamIncidenceList( delSel );
2866} 2873}
2867void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2874void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2868{ 2875{