summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-08-07 17:37:12 (UTC)
committer zautrix <zautrix>2004-08-07 17:37:12 (UTC)
commit2219ddf2cb8022a24101e45ca439e65e95743388 (patch) (unidiff)
tree3e15d6b069a82901a5e032f641889b1870fc6ede /korganizer
parent88b0d33b8b0b1f6ae320cfc863ca6a47fa8fec22 (diff)
downloadkdepimpi-2219ddf2cb8022a24101e45ca439e65e95743388.zip
kdepimpi-2219ddf2cb8022a24101e45ca439e65e95743388.tar.gz
kdepimpi-2219ddf2cb8022a24101e45ca439e65e95743388.tar.bz2
added gammu
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp42
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp8
3 files changed, 41 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 689618d..a7f7010 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,181 +1,182 @@
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 (preston.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>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66 66
67#include <libkcal/vcaldrag.h> 67#include <libkcal/vcaldrag.h>
68#include <libkcal/icaldrag.h> 68#include <libkcal/icaldrag.h>
69#include <libkcal/icalformat.h> 69#include <libkcal/icalformat.h>
70#include <libkcal/vcalformat.h> 70#include <libkcal/vcalformat.h>
71#include <libkcal/scheduler.h> 71#include <libkcal/scheduler.h>
72#include <libkcal/calendarlocal.h> 72#include <libkcal/calendarlocal.h>
73#include <libkcal/journal.h> 73#include <libkcal/journal.h>
74#include <libkcal/calfilter.h> 74#include <libkcal/calfilter.h>
75#include <libkcal/attendee.h> 75#include <libkcal/attendee.h>
76#include <libkcal/dndfactory.h> 76#include <libkcal/dndfactory.h>
77#include <libkcal/freebusy.h> 77#include <libkcal/freebusy.h>
78#include <libkcal/filestorage.h> 78#include <libkcal/filestorage.h>
79#include <libkcal/calendarresources.h> 79#include <libkcal/calendarresources.h>
80#include <libkcal/qtopiaformat.h> 80#include <libkcal/qtopiaformat.h>
81#include "../kalarmd/alarmdialog.h" 81#include "../kalarmd/alarmdialog.h"
82 82
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84#include <libkcal/sharpformat.h> 84#include <libkcal/sharpformat.h>
85#endif 85#endif
86#include <libkcal/phoneformat.h>
86#ifndef KORG_NOMAIL 87#ifndef KORG_NOMAIL
87#include "komailclient.h" 88#include "komailclient.h"
88#endif 89#endif
89#ifndef KORG_NOPRINTER 90#ifndef KORG_NOPRINTER
90#include "calprinter.h" 91#include "calprinter.h"
91#endif 92#endif
92#ifndef KORG_NOPLUGINS 93#ifndef KORG_NOPLUGINS
93#include "kocore.h" 94#include "kocore.h"
94#endif 95#endif
95#include "koeventeditor.h" 96#include "koeventeditor.h"
96#include "kotodoeditor.h" 97#include "kotodoeditor.h"
97#include "koprefs.h" 98#include "koprefs.h"
98#include "koeventviewerdialog.h" 99#include "koeventviewerdialog.h"
99#include "publishdialog.h" 100#include "publishdialog.h"
100#include "kofilterview.h" 101#include "kofilterview.h"
101#include "koglobals.h" 102#include "koglobals.h"
102#include "koviewmanager.h" 103#include "koviewmanager.h"
103#include "koagendaview.h" 104#include "koagendaview.h"
104#include "kodialogmanager.h" 105#include "kodialogmanager.h"
105#include "outgoingdialog.h" 106#include "outgoingdialog.h"
106#include "incomingdialog.h" 107#include "incomingdialog.h"
107#include "statusdialog.h" 108#include "statusdialog.h"
108#include "kdatenavigator.h" 109#include "kdatenavigator.h"
109#include "kotodoview.h" 110#include "kotodoview.h"
110#include "datenavigator.h" 111#include "datenavigator.h"
111#include "resourceview.h" 112#include "resourceview.h"
112#include "navigatorbar.h" 113#include "navigatorbar.h"
113#include "searchdialog.h" 114#include "searchdialog.h"
114#include "mainwindow.h" 115#include "mainwindow.h"
115 116
116#include "calendarview.h" 117#include "calendarview.h"
117#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
118#include <qtopia/alarmserver.h> 119#include <qtopia/alarmserver.h>
119#endif 120#endif
120#ifndef _WIN32_ 121#ifndef _WIN32_
121#include <stdlib.h> 122#include <stdlib.h>
122#include <stdio.h> 123#include <stdio.h>
123#include <unistd.h> 124#include <unistd.h>
124#else 125#else
125#include <qprocess.h> 126#include <qprocess.h>
126#endif 127#endif
127using namespace KOrg; 128using namespace KOrg;
128using namespace KCal; 129using namespace KCal;
129extern int globalFlagBlockAgenda; 130extern int globalFlagBlockAgenda;
130extern int globalFlagBlockStartup; 131extern int globalFlagBlockStartup;
131 132
132 133
133 134
134class KOBeamPrefs : public QDialog 135class KOBeamPrefs : public QDialog
135{ 136{
136 public: 137 public:
137 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 138 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
138 QDialog( parent, name, true ) 139 QDialog( parent, name, true )
139 { 140 {
140 setCaption( i18n("Beam Options") ); 141 setCaption( i18n("Beam Options") );
141 QVBoxLayout* lay = new QVBoxLayout( this ); 142 QVBoxLayout* lay = new QVBoxLayout( this );
142 lay->setSpacing( 3 ); 143 lay->setSpacing( 3 );
143 lay->setMargin( 3 ); 144 lay->setMargin( 3 );
144 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 145 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
145 lay->addWidget( format ); 146 lay->addWidget( format );
146 format->setExclusive ( true ) ; 147 format->setExclusive ( true ) ;
147 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 148 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
148 lay->addWidget( time ); time->setExclusive ( true ) ; 149 lay->addWidget( time ); time->setExclusive ( true ) ;
149 vcal = new QRadioButton(" vCalendar ", format ); 150 vcal = new QRadioButton(" vCalendar ", format );
150 ical = new QRadioButton(" iCalendar ", format ); 151 ical = new QRadioButton(" iCalendar ", format );
151 vcal->setChecked( true ); 152 vcal->setChecked( true );
152 tz = new QRadioButton(i18n(" With timezone "), time ); 153 tz = new QRadioButton(i18n(" With timezone "), time );
153 local = new QRadioButton(i18n(" Local time "), time ); 154 local = new QRadioButton(i18n(" Local time "), time );
154 tz->setChecked( true ); 155 tz->setChecked( true );
155 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 156 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
156 lay->addWidget( ok ); 157 lay->addWidget( ok );
157 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 158 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
158 lay->addWidget( cancel ); 159 lay->addWidget( cancel );
159 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 160 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
160 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 161 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
161 resize( 200, 200 ); 162 resize( 200, 200 );
162 } 163 }
163 164
164 bool beamVcal() { return vcal->isChecked(); } 165 bool beamVcal() { return vcal->isChecked(); }
165 bool beamLocal() { return local->isChecked(); } 166 bool beamLocal() { return local->isChecked(); }
166private: 167private:
167 QRadioButton* vcal, *ical, *local, *tz; 168 QRadioButton* vcal, *ical, *local, *tz;
168}; 169};
169class KOCatPrefs : public QDialog 170class KOCatPrefs : public QDialog
170{ 171{
171 public: 172 public:
172 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 173 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
173 QDialog( parent, name, true ) 174 QDialog( parent, name, true )
174 { 175 {
175 setCaption( i18n("Manage new Categories") ); 176 setCaption( i18n("Manage new Categories") );
176 QVBoxLayout* lay = new QVBoxLayout( this ); 177 QVBoxLayout* lay = new QVBoxLayout( this );
177 lay->setSpacing( 3 ); 178 lay->setSpacing( 3 );
178 lay->setMargin( 3 ); 179 lay->setMargin( 3 );
179 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 ); 180 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 );
180 lay->addWidget( lab ); 181 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
@@ -1082,256 +1083,279 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1082 skipIncidence = true; 1083 skipIncidence = true;
1083 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1084 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1084 skipIncidence = true; 1085 skipIncidence = true;
1085 if ( !skipIncidence ) { 1086 if ( !skipIncidence ) {
1086 inR = remote->incidence( uid ); 1087 inR = remote->incidence( uid );
1087 if ( ! inR ) { 1088 if ( ! inR ) {
1088 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1089 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1089 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1090 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1090 local->deleteIncidence( inL ); 1091 local->deleteIncidence( inL );
1091 ++deletedEventL; 1092 ++deletedEventL;
1092 } else { 1093 } else {
1093 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1094 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1094 inL->removeID(mCurrentSyncDevice ); 1095 inL->removeID(mCurrentSyncDevice );
1095 ++addedEventR; 1096 ++addedEventR;
1096 inL->setLastModified( modifiedCalendar ); 1097 inL->setLastModified( modifiedCalendar );
1097 remote->addIncidence( inL->clone() ); 1098 remote->addIncidence( inL->clone() );
1098 } 1099 }
1099 } 1100 }
1100 } else { 1101 } else {
1101 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1102 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1102 checkExternSyncEvent(eventLSyncSharp, inL); 1103 checkExternSyncEvent(eventLSyncSharp, inL);
1103 local->deleteIncidence( inL ); 1104 local->deleteIncidence( inL );
1104 ++deletedEventL; 1105 ++deletedEventL;
1105 } else { 1106 } else {
1106 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1107 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1107 ++addedEventR; 1108 ++addedEventR;
1108 inL->setLastModified( modifiedCalendar ); 1109 inL->setLastModified( modifiedCalendar );
1109 remote->addIncidence( inL->clone() ); 1110 remote->addIncidence( inL->clone() );
1110 } 1111 }
1111 } 1112 }
1112 } 1113 }
1113 } 1114 }
1114 } 1115 }
1115 inL = el.next(); 1116 inL = el.next();
1116 } 1117 }
1117 1118
1118 bar.hide(); 1119 bar.hide();
1119 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1120 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1120 eventLSync->setReadOnly( false ); 1121 eventLSync->setReadOnly( false );
1121 eventLSync->setDtStart( mLastCalendarSync ); 1122 eventLSync->setDtStart( mLastCalendarSync );
1122 eventRSync->setDtStart( mLastCalendarSync ); 1123 eventRSync->setDtStart( mLastCalendarSync );
1123 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1124 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1124 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1125 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1125 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1126 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1126 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1127 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1127 eventLSync->setReadOnly( true ); 1128 eventLSync->setReadOnly( true );
1128 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1129 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1129 remote->addEvent( eventRSync ); 1130 remote->addEvent( eventRSync );
1130 QString mes; 1131 QString mes;
1131 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1132 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1132 if ( KOPrefs::instance()->mShowSyncSummary ) { 1133 if ( KOPrefs::instance()->mShowSyncSummary ) {
1133 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1134 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1134 } 1135 }
1135 qDebug( mes ); 1136 qDebug( mes );
1136 mCalendar->checkAlarmForIncidence( 0, true ); 1137 mCalendar->checkAlarmForIncidence( 0, true );
1137 return syncOK; 1138 return syncOK;
1138} 1139}
1139 1140
1140void CalendarView::setSyncDevice( QString s ) 1141void CalendarView::setSyncDevice( QString s )
1141{ 1142{
1142 mCurrentSyncDevice= s; 1143 mCurrentSyncDevice= s;
1143} 1144}
1144void CalendarView::setSyncName( QString s ) 1145void CalendarView::setSyncName( QString s )
1145{ 1146{
1146 mCurrentSyncName= s; 1147 mCurrentSyncName= s;
1147} 1148}
1148bool CalendarView::syncCalendar(QString filename, int mode) 1149bool CalendarView::syncCalendar(QString filename, int mode)
1149{ 1150{
1150 mGlobalSyncMode = SYNC_MODE_NORMAL; 1151 mGlobalSyncMode = SYNC_MODE_NORMAL;
1151 CalendarLocal* calendar = new CalendarLocal(); 1152 CalendarLocal* calendar = new CalendarLocal();
1152 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1153 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1153 FileStorage* storage = new FileStorage( calendar ); 1154 FileStorage* storage = new FileStorage( calendar );
1154 bool syncOK = false; 1155 bool syncOK = false;
1155 storage->setFileName( filename ); 1156 storage->setFileName( filename );
1156 // qDebug("loading ... "); 1157 // qDebug("loading ... ");
1157 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1158 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1158 getEventViewerDialog()->setSyncMode( true ); 1159 getEventViewerDialog()->setSyncMode( true );
1159 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1160 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1160 getEventViewerDialog()->setSyncMode( false ); 1161 getEventViewerDialog()->setSyncMode( false );
1161 if ( syncOK ) { 1162 if ( syncOK ) {
1162 if ( KOPrefs::instance()->mWriteBackFile ) 1163 if ( KOPrefs::instance()->mWriteBackFile )
1163 { 1164 {
1164 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1165 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1165 storage->save(); 1166 storage->save();
1166 } 1167 }
1167 } 1168 }
1168 setModified( true ); 1169 setModified( true );
1169 } 1170 }
1170 delete storage; 1171 delete storage;
1171 delete calendar; 1172 delete calendar;
1172 if ( syncOK ) 1173 if ( syncOK )
1173 updateView(); 1174 updateView();
1174 return syncOK; 1175 return syncOK;
1175} 1176}
1176void CalendarView::syncPhone() 1177void CalendarView::syncPhone()
1177{ 1178{
1178 qDebug("CalendarView::syncPhone() "); 1179 syncExternal( 1 );
1179} 1180}
1180void CalendarView::syncSharp() 1181void CalendarView::syncExternal( int mode )
1181{ 1182{
1182#ifndef DESKTOP_VERSION 1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1184 //mCurrentSyncDevice = "sharp-DTM"; 1184 //mCurrentSyncDevice = "sharp-DTM";
1185 if ( KOPrefs::instance()->mAskForPreferences ) 1185 if ( KOPrefs::instance()->mAskForPreferences )
1186 edit_sync_options(); 1186 edit_sync_options();
1187 qApp->processEvents(); 1187 qApp->processEvents();
1188 CalendarLocal* calendar = new CalendarLocal(); 1188 CalendarLocal* calendar = new CalendarLocal();
1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1190 bool syncOK = false; 1190 bool syncOK = false;
1191 SharpFormat sharpFormat; 1191 boo loadSuccess = false;
1192 if ( sharpFormat.load( calendar, mCalendar ) ) { 1192 PhoneFormat* phoneFormat = 0;
1193#ifndef DESKTOP_VERSION
1194 SharpFormat* sharpFormat = 0;
1195 if ( mode == 0 ) { // sharp
1196 sharpFormat = new SharpFormat () ;
1197 loadSuccess = sharpFormat->load( calendar, mCalendar );
1198
1199 } else
1200#endif
1201 if ( mode == 1 ) { // phone
1202 phoneFormat = new PhoneFormat ();
1203 loadSuccess = phoneFormat->load( calendar, mCalendar );
1204
1205 } else
1206 return;
1207 if ( loadSuccess ) {
1193 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1194 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1195 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
1196 qApp->processEvents(); 1211 qApp->processEvents();
1197 if ( syncOK ) { 1212 if ( syncOK ) {
1198 if ( KOPrefs::instance()->mWriteBackFile ) 1213 if ( KOPrefs::instance()->mWriteBackFile )
1199 { 1214 {
1200 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1215 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1201 Incidence* inc = iL.first(); 1216 Incidence* inc = iL.first();
1202 /* obsolete 1217 /* obsolete
1203 while ( inc ) { 1218 while ( inc ) {
1204 inc->setZaurusStat( inc->revision () ); 1219 inc->setZaurusStat( inc->revision () );
1205 inc = iL.next(); 1220 inc = iL.next();
1206 } 1221 }
1207 */ 1222 */
1208 // pending: clean last sync event description 1223#ifndef DESKTOP_VERSION
1209 sharpFormat.save(calendar); 1224 if ( sharpFormat )
1225 sharpFormat->save(calendar);
1226#endif
1227 if ( phoneFormat )
1228 phoneFormat->save(calendar);
1210 iL = calendar->rawIncidences(); 1229 iL = calendar->rawIncidences();
1211 inc = iL.first(); 1230 inc = iL.first();
1212 Incidence* loc; 1231 Incidence* loc;
1213 while ( inc ) { 1232 while ( inc ) {
1214 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1233 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1215 loc = mCalendar->incidence(inc->uid() ); 1234 loc = mCalendar->incidence(inc->uid() );
1216 if ( loc ) { 1235 if ( loc ) {
1217 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1236 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1218 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1237 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1219 } 1238 }
1220 } 1239 }
1221 inc = iL.next(); 1240 inc = iL.next();
1222 } 1241 }
1223 Incidence* lse = getLastSyncEvent(); 1242 Incidence* lse = getLastSyncEvent();
1224 if ( lse ) { 1243 if ( lse ) {
1225 lse->setReadOnly( false ); 1244 lse->setReadOnly( false );
1226 lse->setDescription( "" ); 1245 lse->setDescription( "" );
1227 lse->setReadOnly( true ); 1246 lse->setReadOnly( true );
1228 } 1247 }
1229 } 1248 }
1230 } 1249 }
1231 setModified( true ); 1250 setModified( true );
1232 } else { 1251 } else {
1233 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1252 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1234 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1253 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1235 question, i18n("Ok")) ; 1254 question, i18n("Ok")) ;
1236 1255
1237 } 1256 }
1238 delete calendar; 1257 delete calendar;
1239 updateView(); 1258 updateView();
1240 return ;//syncOK; 1259 return ;//syncOK;
1241#endif 1260
1261}
1262void CalendarView::syncSharp()
1263{
1264 syncExternal( 0 );
1265
1242} 1266}
1243 1267
1244 1268
1245#include <kabc/stdaddressbook.h> 1269#include <kabc/stdaddressbook.h>
1246bool CalendarView::importBday() 1270bool CalendarView::importBday()
1247{ 1271{
1248 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1272 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1249 KABC::AddressBook::Iterator it; 1273 KABC::AddressBook::Iterator it;
1250 int count = 0; 1274 int count = 0;
1251 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1275 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1252 ++count; 1276 ++count;
1253 } 1277 }
1254 QProgressBar bar(count,0 ); 1278 QProgressBar bar(count,0 );
1255 int w = 300; 1279 int w = 300;
1256 if ( QApplication::desktop()->width() < 320 ) 1280 if ( QApplication::desktop()->width() < 320 )
1257 w = 220; 1281 w = 220;
1258 int h = bar.sizeHint().height() ; 1282 int h = bar.sizeHint().height() ;
1259 int dw = QApplication::desktop()->width(); 1283 int dw = QApplication::desktop()->width();
1260 int dh = QApplication::desktop()->height(); 1284 int dh = QApplication::desktop()->height();
1261 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1285 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1262 bar.show(); 1286 bar.show();
1263 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1287 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1264 qApp->processEvents(); 1288 qApp->processEvents();
1265 count = 0; 1289 count = 0;
1266 int addCount = 0; 1290 int addCount = 0;
1267 KCal::Attendee* a = 0; 1291 KCal::Attendee* a = 0;
1268 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1292 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1269 if ( ! bar.isVisible() ) 1293 if ( ! bar.isVisible() )
1270 return false; 1294 return false;
1271 bar.setProgress( count++ ); 1295 bar.setProgress( count++ );
1272 qApp->processEvents(); 1296 qApp->processEvents();
1273 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1297 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1274 if ( (*it).birthday().date().isValid() ){ 1298 if ( (*it).birthday().date().isValid() ){
1275 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1299 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1276 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1300 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1277 ++addCount; 1301 ++addCount;
1278 } 1302 }
1279 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1303 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1280 if ( anni.isValid() ){ 1304 if ( anni.isValid() ){
1281 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1305 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1282 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1306 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1283 ++addCount; 1307 ++addCount;
1284 } 1308 }
1285 } 1309 }
1286 updateView(); 1310 updateView();
1287 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1311 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1288 return true; 1312 return true;
1289} 1313}
1290 1314
1291bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1315bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1292{ 1316{
1293 //qDebug("addAnni "); 1317 //qDebug("addAnni ");
1294 Event * ev = new Event(); 1318 Event * ev = new Event();
1295 if ( a ) { 1319 if ( a ) {
1296 ev->addAttendee( a ); 1320 ev->addAttendee( a );
1297 } 1321 }
1298 QString kind; 1322 QString kind;
1299 if ( birthday ) 1323 if ( birthday )
1300 kind = i18n( "Birthday" ); 1324 kind = i18n( "Birthday" );
1301 else 1325 else
1302 kind = i18n( "Anniversary" ); 1326 kind = i18n( "Anniversary" );
1303 ev->setSummary( name + " - " + kind ); 1327 ev->setSummary( name + " - " + kind );
1304 ev->setOrganizer( "nobody@nowhere" ); 1328 ev->setOrganizer( "nobody@nowhere" );
1305 ev->setCategories( kind ); 1329 ev->setCategories( kind );
1306 ev->setDtStart( QDateTime(date) ); 1330 ev->setDtStart( QDateTime(date) );
1307 ev->setDtEnd( QDateTime(date) ); 1331 ev->setDtEnd( QDateTime(date) );
1308 ev->setFloats( true ); 1332 ev->setFloats( true );
1309 Recurrence * rec = ev->recurrence(); 1333 Recurrence * rec = ev->recurrence();
1310 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1334 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1311 rec->addYearlyNum( date.month() ); 1335 rec->addYearlyNum( date.month() );
1312 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1336 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1313 delete ev; 1337 delete ev;
1314 return false; 1338 return false;
1315 } 1339 }
1316 return true; 1340 return true;
1317 1341
1318} 1342}
1319bool CalendarView::importQtopia( const QString &categories, 1343bool CalendarView::importQtopia( const QString &categories,
1320 const QString &datebook, 1344 const QString &datebook,
1321 const QString &todolist ) 1345 const QString &todolist )
1322{ 1346{
1323 1347
1324 QtopiaFormat qtopiaFormat; 1348 QtopiaFormat qtopiaFormat;
1325 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1349 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1326 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1350 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1327 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1351 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1328 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1352 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1329 1353
1330 updateView(); 1354 updateView();
1331 return true; 1355 return true;
1332 1356
1333#if 0 1357#if 0
1334 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1358 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1335 mCurrentSyncDevice = "qtopia-XML"; 1359 mCurrentSyncDevice = "qtopia-XML";
1336 if ( KOPrefs::instance()->mAskForPreferences ) 1360 if ( KOPrefs::instance()->mAskForPreferences )
1337 edit_sync_options(); 1361 edit_sync_options();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index b2838db..a3315ad 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -333,192 +333,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
333 void appointment_edit(); 333 void appointment_edit();
334 /** 334 /**
335 * pop up dialog confirming deletion of currently selected event in the 335 * pop up dialog confirming deletion of currently selected event in the
336 * View. 336 * View.
337 */ 337 */
338 void appointment_delete(); 338 void appointment_delete();
339 339
340 /** mails the currently selected event to a particular user as a vCalendar 340 /** mails the currently selected event to a particular user as a vCalendar
341 attachment. */ 341 attachment. */
342 void action_mail(); 342 void action_mail();
343 343
344 /* frees a subtodo from it's relation */ 344 /* frees a subtodo from it's relation */
345 void todo_unsub( Todo * ); 345 void todo_unsub( Todo * );
346 346
347 /** Take ownership of selected event. */ 347 /** Take ownership of selected event. */
348 void takeOverEvent(); 348 void takeOverEvent();
349 349
350 /** Take ownership of all events in calendar. */ 350 /** Take ownership of all events in calendar. */
351 void takeOverCalendar(); 351 void takeOverCalendar();
352 352
353 /** query whether or not the calendar is "dirty". */ 353 /** query whether or not the calendar is "dirty". */
354 bool isModified(); 354 bool isModified();
355 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 355 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
356 void setModified(bool modified=true); 356 void setModified(bool modified=true);
357 357
358 /** query if the calendar is read-only. */ 358 /** query if the calendar is read-only. */
359 bool isReadOnly(); 359 bool isReadOnly();
360 /** set state of calendar to read-only */ 360 /** set state of calendar to read-only */
361 void setReadOnly(bool readOnly=true); 361 void setReadOnly(bool readOnly=true);
362 362
363 void eventUpdated(Incidence *); 363 void eventUpdated(Incidence *);
364 364
365 /* iTIP scheduling actions */ 365 /* iTIP scheduling actions */
366 void schedule_publish(Incidence *incidence = 0); 366 void schedule_publish(Incidence *incidence = 0);
367 void schedule_request(Incidence *incidence = 0); 367 void schedule_request(Incidence *incidence = 0);
368 void schedule_refresh(Incidence *incidence = 0); 368 void schedule_refresh(Incidence *incidence = 0);
369 void schedule_cancel(Incidence *incidence = 0); 369 void schedule_cancel(Incidence *incidence = 0);
370 void schedule_add(Incidence *incidence = 0); 370 void schedule_add(Incidence *incidence = 0);
371 void schedule_reply(Incidence *incidence = 0); 371 void schedule_reply(Incidence *incidence = 0);
372 void schedule_counter(Incidence *incidence = 0); 372 void schedule_counter(Incidence *incidence = 0);
373 void schedule_declinecounter(Incidence *incidence = 0); 373 void schedule_declinecounter(Incidence *incidence = 0);
374 void schedule_publish_freebusy(int daysToPublish = 30); 374 void schedule_publish_freebusy(int daysToPublish = 30);
375 375
376 void openAddressbook(); 376 void openAddressbook();
377 377
378 void editFilters(); 378 void editFilters();
379 void toggleFilerEnabled(); 379 void toggleFilerEnabled();
380 QPtrList<CalFilter> filters(); 380 QPtrList<CalFilter> filters();
381 void toggleFilter(); 381 void toggleFilter();
382 void showFilter(bool visible); 382 void showFilter(bool visible);
383 void updateFilter(); 383 void updateFilter();
384 void filterEdited(); 384 void filterEdited();
385 void selectFilter( int ); 385 void selectFilter( int );
386 KOFilterView *filterView(); 386 KOFilterView *filterView();
387 387
388 void showIntro(); 388 void showIntro();
389 389
390 /** Move the curdatepient view date to today */ 390 /** Move the curdatepient view date to today */
391 void goToday(); 391 void goToday();
392 392
393 /** Move to the next date(s) in the current view */ 393 /** Move to the next date(s) in the current view */
394 void goNext(); 394 void goNext();
395 395
396 /** Move to the previous date(s) in the current view */ 396 /** Move to the previous date(s) in the current view */
397 void goPrevious(); 397 void goPrevious();
398 /** Move to the next date(s) in the current view */ 398 /** Move to the next date(s) in the current view */
399 void goNextMonth(); 399 void goNextMonth();
400 400
401 /** Move to the previous date(s) in the current view */ 401 /** Move to the previous date(s) in the current view */
402 void goPreviousMonth(); 402 void goPreviousMonth();
403 403
404 void toggleExpand(); 404 void toggleExpand();
405 void toggleDateNavigatorWidget(); 405 void toggleDateNavigatorWidget();
406 void toggleAllDaySize(); 406 void toggleAllDaySize();
407 void dialogClosing(Incidence *); 407 void dialogClosing(Incidence *);
408 408
409 /** Look for new messages in the inbox */ 409 /** Look for new messages in the inbox */
410 void lookForIncomingMessages(); 410 void lookForIncomingMessages();
411 /** Look for new messages in the outbox */ 411 /** Look for new messages in the outbox */
412 void lookForOutgoingMessages(); 412 void lookForOutgoingMessages();
413 413
414 void processMainViewSelection( Incidence * ); 414 void processMainViewSelection( Incidence * );
415 void processTodoListSelection( Incidence * ); 415 void processTodoListSelection( Incidence * );
416 416
417 void processIncidenceSelection( Incidence * ); 417 void processIncidenceSelection( Incidence * );
418 418
419 void purgeCompleted(); 419 void purgeCompleted();
420 bool removeCompletedSubTodos( Todo* ); 420 bool removeCompletedSubTodos( Todo* );
421 void slotCalendarChanged(); 421 void slotCalendarChanged();
422 bool importBday(); 422 bool importBday();
423 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 423 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
424 bool importQtopia( const QString &categoriesFile, 424 bool importQtopia( const QString &categoriesFile,
425 const QString &datebookFile, 425 const QString &datebookFile,
426 const QString &tasklistFile ); 426 const QString &tasklistFile );
427 void syncSharp( ); 427 void syncSharp( );
428 void syncPhone( ); 428 void syncPhone( );
429 void syncExternal( int mode );
429 void slotSelectPickerDate( QDate ) ; 430 void slotSelectPickerDate( QDate ) ;
430 void showDatePicker( ) ; 431 void showDatePicker( ) ;
431 void moveIncidence(Incidence *) ; 432 void moveIncidence(Incidence *) ;
432 void beamIncidence(Incidence *) ; 433 void beamIncidence(Incidence *) ;
433 void beamCalendar() ; 434 void beamCalendar() ;
434 void beamFilteredCalendar() ; 435 void beamFilteredCalendar() ;
435 void beamIncidenceList(QPtrList<Incidence>) ; 436 void beamIncidenceList(QPtrList<Incidence>) ;
436 void manageCategories(); 437 void manageCategories();
437 int addCategories(); 438 int addCategories();
438 void removeCategories(); 439 void removeCategories();
439 void setSyncDevice( QString ); 440 void setSyncDevice( QString );
440 void setSyncName( QString ); 441 void setSyncName( QString );
441 protected slots: 442 protected slots:
442 void timerAlarm(); 443 void timerAlarm();
443 void suspendAlarm(); 444 void suspendAlarm();
444 void beamDone( Ir *ir ); 445 void beamDone( Ir *ir );
445 /** Select a view or adapt the current view to display the specified dates. */ 446 /** Select a view or adapt the current view to display the specified dates. */
446 void showDates( const KCal::DateList & ); 447 void showDates( const KCal::DateList & );
447 void selectWeekNum ( int ); 448 void selectWeekNum ( int );
448 449
449 public: 450 public:
450 // show a standard warning 451 // show a standard warning
451 // returns KMsgBox::yesNoCancel() 452 // returns KMsgBox::yesNoCancel()
452 int msgCalModified(); 453 int msgCalModified();
453 void confSync(); 454 void confSync();
454 void setLoadedFileVersion(QDateTime); 455 void setLoadedFileVersion(QDateTime);
455 bool checkFileVersion(QString fn); 456 bool checkFileVersion(QString fn);
456 bool checkFileChanged(QString fn); 457 bool checkFileChanged(QString fn);
457 Event* getLastSyncEvent(); 458 Event* getLastSyncEvent();
458 /** Adapt navigation units correpsonding to step size of navigation of the 459 /** Adapt navigation units correpsonding to step size of navigation of the
459 * current view. 460 * current view.
460 */ 461 */
461 void adaptNavigationUnits(); 462 void adaptNavigationUnits();
462 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 463 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
463 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 464 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
464 //Attendee* getYourAttendee(Event *event); 465 //Attendee* getYourAttendee(Event *event);
465 protected: 466 protected:
466 void schedule(Scheduler::Method, Incidence *incidence = 0); 467 void schedule(Scheduler::Method, Incidence *incidence = 0);
467 468
468 // returns KMsgBox::OKCandel() 469 // returns KMsgBox::OKCandel()
469 int msgItemDelete(); 470 int msgItemDelete();
470 void showEventEditor(); 471 void showEventEditor();
471 void showTodoEditor(); 472 void showTodoEditor();
472 void writeLocale(); 473 void writeLocale();
473 Todo *selectedTodo(); 474 Todo *selectedTodo();
474 475
475 private: 476 private:
476 AlarmDialog * mAlarmDialog; 477 AlarmDialog * mAlarmDialog;
477 QString mAlarmNotification; 478 QString mAlarmNotification;
478 QString mSuspendAlarmNotification; 479 QString mSuspendAlarmNotification;
479 QTimer* mSuspendTimer; 480 QTimer* mSuspendTimer;
480 QTimer* mAlarmTimer; 481 QTimer* mAlarmTimer;
481 QTimer* mRecheckAlarmTimer; 482 QTimer* mRecheckAlarmTimer;
482 void computeAlarm( QString ); 483 void computeAlarm( QString );
483 void startAlarm( QString, QString ); 484 void startAlarm( QString, QString );
484 void setSyncEventsReadOnly(); 485 void setSyncEventsReadOnly();
485 486
486 QDateTime loadedFileVersion; 487 QDateTime loadedFileVersion;
487 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 488 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
488 void checkExternalId( Incidence * inc ); 489 void checkExternalId( Incidence * inc );
489 int mGlobalSyncMode; 490 int mGlobalSyncMode;
490 QString mCurrentSyncDevice; 491 QString mCurrentSyncDevice;
491 QString mCurrentSyncName; 492 QString mCurrentSyncName;
492 KOBeamPrefs* beamDialog; 493 KOBeamPrefs* beamDialog;
493 void init(); 494 void init();
494 int mDatePickerMode; 495 int mDatePickerMode;
495 bool mFlagEditDescription; 496 bool mFlagEditDescription;
496 QDateTime mLastCalendarSync; 497 QDateTime mLastCalendarSync;
497 void createPrinter(); 498 void createPrinter();
498 499
499 void calendarModified( bool, Calendar * ); 500 void calendarModified( bool, Calendar * );
500 501
501 CalPrinter *mCalPrinter; 502 CalPrinter *mCalPrinter;
502 503
503 QSplitter *mPanner; 504 QSplitter *mPanner;
504 QSplitter *mLeftSplitter; 505 QSplitter *mLeftSplitter;
505 QWidget *mLeftFrame; 506 QWidget *mLeftFrame;
506 QWidgetStack *mRightFrame; 507 QWidgetStack *mRightFrame;
507 508
508 KDatePicker* mDatePicker; 509 KDatePicker* mDatePicker;
509 QVBox* mDateFrame; 510 QVBox* mDateFrame;
510 NavigatorBar *mNavigatorBar; 511 NavigatorBar *mNavigatorBar;
511 512
512 KDateNavigator *mDateNavigator; // widget showing small month view. 513 KDateNavigator *mDateNavigator; // widget showing small month view.
513 514
514 KOFilterView *mFilterView; 515 KOFilterView *mFilterView;
515 516
516 ResourceView *mResourceView; 517 ResourceView *mResourceView;
517 518
518 // calendar object for this viewing instance 519 // calendar object for this viewing instance
519 Calendar *mCalendar; 520 Calendar *mCalendar;
520 521
521 CalendarResourceManager *mResourceManager; 522 CalendarResourceManager *mResourceManager;
522 523
523 FileStorage *mStorage; 524 FileStorage *mStorage;
524 525
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 062c95f..cce182a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -907,193 +907,199 @@ int MainWindow::ringSync()
907 907
908 } 908 }
909 } 909 }
910 timer.start(); 910 timer.start();
911 setCaption(i18n("Multiple sync in progress ... please wait!") ); 911 setCaption(i18n("Multiple sync in progress ... please wait!") );
912 while ( timer.elapsed () < 2000 ) { 912 while ( timer.elapsed () < 2000 ) {
913 qApp->processEvents(); 913 qApp->processEvents();
914#ifndef _WIN32_ 914#ifndef _WIN32_
915 sleep (1); 915 sleep (1);
916#endif 916#endif
917 } 917 }
918 918
919 } 919 }
920 920
921 } 921 }
922 delete temp; 922 delete temp;
923 return syncedProfiles; 923 return syncedProfiles;
924} 924}
925 925
926void MainWindow::multiSync( bool askforPrefs ) 926void MainWindow::multiSync( bool askforPrefs )
927{ 927{
928 if (mBlockSaveFlag) 928 if (mBlockSaveFlag)
929 return; 929 return;
930 mBlockSaveFlag = true; 930 mBlockSaveFlag = true;
931 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 931 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
932 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 932 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
933 question, 933 question,
934 i18n("Yes"), i18n("No"), 934 i18n("Yes"), i18n("No"),
935 0, 0 ) != 0 ) { 935 0, 0 ) != 0 ) {
936 mBlockSaveFlag = false; 936 mBlockSaveFlag = false;
937 setCaption(i18n("Aborted! Nothing synced!")); 937 setCaption(i18n("Aborted! Nothing synced!"));
938 return; 938 return;
939 } 939 }
940 mView->setSyncDevice(i18n("Multiple profiles") ); 940 mView->setSyncDevice(i18n("Multiple profiles") );
941 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 941 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
942 if ( askforPrefs ) { 942 if ( askforPrefs ) {
943 mView->edit_sync_options(); 943 mView->edit_sync_options();
944 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 944 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
945 } 945 }
946 setCaption(i18n("Multiple sync started.") ); 946 setCaption(i18n("Multiple sync started.") );
947 qApp->processEvents(); 947 qApp->processEvents();
948 int num = ringSync() ; 948 int num = ringSync() ;
949 if ( num > 1 ) 949 if ( num > 1 )
950 ringSync(); 950 ringSync();
951 mBlockSaveFlag = false; 951 mBlockSaveFlag = false;
952 if ( num ) 952 if ( num )
953 save(); 953 save();
954 if ( num ) 954 if ( num )
955 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 955 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
956 else 956 else
957 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 957 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
958 return; 958 return;
959} 959}
960void MainWindow::slotSyncMenu( int action ) 960void MainWindow::slotSyncMenu( int action )
961{ 961{
962 //qDebug("syncaction %d ", action); 962 //qDebug("syncaction %d ", action);
963 if ( action == 0 ) { 963 if ( action == 0 ) {
964 964
965 confSync(); 965 confSync();
966 966
967 return; 967 return;
968 } 968 }
969 if ( action == 1 ) { 969 if ( action == 1 ) {
970 multiSync( true ); 970 multiSync( true );
971 return; 971 return;
972 } 972 }
973 973
974 if (mBlockSaveFlag) 974 if (mBlockSaveFlag)
975 return; 975 return;
976 mBlockSaveFlag = true; 976 mBlockSaveFlag = true;
977 mCurrentSyncProfile = action - 1000 ; 977 mCurrentSyncProfile = action - 1000 ;
978 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 978 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
979 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 979 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
980 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 980 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
981 KSyncProfile* temp = new KSyncProfile (); 981 KSyncProfile* temp = new KSyncProfile ();
982 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 982 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
983 temp->readConfig(&config); 983 temp->readConfig(&config);
984 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 984 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
985 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 985 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
986 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 986 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
987 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 987 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
988 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 988 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
989 if ( action == 1000 ) { 989 if ( action == 1000 ) {
990 syncSharp(); 990 syncSharp();
991 991
992 } else if ( action == 1001 ) { 992 } else if ( action == 1001 ) {
993 syncLocalFile(); 993 syncLocalFile();
994 994
995 } else if ( action == 1002 ) { 995 } else if ( action == 1002 ) {
996 quickSyncLocalFile(); 996 quickSyncLocalFile();
997 997
998 } else if ( action >= 1003 ) { 998 } else if ( action >= 1003 ) {
999 if ( temp->getIsLocalFileSync() ) { 999 if ( temp->getIsLocalFileSync() ) {
1000 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 1000 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
1001 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1001 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1002 } else { 1002 } else {
1003 syncRemote( temp ); 1003 if ( temp->getIsPhoneSync() ) {
1004 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1005 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1006 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1007 syncPhone();
1008 } else
1009 syncRemote( temp );
1004 1010
1005 } 1011 }
1006 } 1012 }
1007 delete temp; 1013 delete temp;
1008 mBlockSaveFlag = false; 1014 mBlockSaveFlag = false;
1009} 1015}
1010void MainWindow::setDefaultPreferences() 1016void MainWindow::setDefaultPreferences()
1011{ 1017{
1012 KOPrefs *p = KOPrefs::instance(); 1018 KOPrefs *p = KOPrefs::instance();
1013 1019
1014 p->mCompactDialogs = true; 1020 p->mCompactDialogs = true;
1015 p->mConfirm = true; 1021 p->mConfirm = true;
1016 // p->mEnableQuickTodo = false; 1022 // p->mEnableQuickTodo = false;
1017} 1023}
1018 1024
1019QString MainWindow::resourcePath() 1025QString MainWindow::resourcePath()
1020{ 1026{
1021 return KGlobal::iconLoader()->iconPath(); 1027 return KGlobal::iconLoader()->iconPath();
1022} 1028}
1023 1029
1024void MainWindow::displayText( QString text ,QString cap ) 1030void MainWindow::displayText( QString text ,QString cap )
1025{ 1031{
1026 QDialog dia( this, "name", true ); ; 1032 QDialog dia( this, "name", true ); ;
1027 dia.setCaption( cap ); 1033 dia.setCaption( cap );
1028 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1034 QVBoxLayout* lay = new QVBoxLayout( &dia );
1029 lay->setSpacing( 3 ); 1035 lay->setSpacing( 3 );
1030 lay->setMargin( 3 ); 1036 lay->setMargin( 3 );
1031 QTextBrowser tb ( &dia ); 1037 QTextBrowser tb ( &dia );
1032 lay->addWidget( &tb ); 1038 lay->addWidget( &tb );
1033 tb.setText( text ); 1039 tb.setText( text );
1034#ifdef DESKTOP_VERSION 1040#ifdef DESKTOP_VERSION
1035 dia.resize( 640, 480); 1041 dia.resize( 640, 480);
1036#else 1042#else
1037 dia.showMaximized(); 1043 dia.showMaximized();
1038#endif 1044#endif
1039 dia.exec(); 1045 dia.exec();
1040} 1046}
1041void MainWindow::displayFile( QString fn, QString cap ) 1047void MainWindow::displayFile( QString fn, QString cap )
1042{ 1048{
1043 QString fileName = resourcePath() + fn; 1049 QString fileName = resourcePath() + fn;
1044 QString text; 1050 QString text;
1045 QFile file( fileName ); 1051 QFile file( fileName );
1046 if (!file.open( IO_ReadOnly ) ) { 1052 if (!file.open( IO_ReadOnly ) ) {
1047 return ; 1053 return ;
1048 1054
1049 } 1055 }
1050 QTextStream ts( &file ); 1056 QTextStream ts( &file );
1051 text = ts.read(); 1057 text = ts.read();
1052 file.close(); 1058 file.close();
1053 displayText( text, cap); 1059 displayText( text, cap);
1054} 1060}
1055void MainWindow::features() 1061void MainWindow::features()
1056{ 1062{
1057 1063
1058 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1064 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1059} 1065}
1060 1066
1061void MainWindow::usertrans() 1067void MainWindow::usertrans()
1062{ 1068{
1063 1069
1064 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1070 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1065} 1071}
1066void MainWindow::synchowto() 1072void MainWindow::synchowto()
1067{ 1073{
1068 1074
1069 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1075 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1070} 1076}
1071void MainWindow::faq() 1077void MainWindow::faq()
1072{ 1078{
1073 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1079 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1074 1080
1075} 1081}
1076void MainWindow::whatsNew() 1082void MainWindow::whatsNew()
1077{ 1083{
1078 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1084 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1079 1085
1080} 1086}
1081void MainWindow::licence() 1087void MainWindow::licence()
1082{ 1088{
1083 KApplication::showLicence(); 1089 KApplication::showLicence();
1084 1090
1085} 1091}
1086void MainWindow::about() 1092void MainWindow::about()
1087{ 1093{
1088 QString version; 1094 QString version;
1089#include <../version> 1095#include <../version>
1090 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1096 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1091 i18n("KOrganizer/Platform-independent\n") + 1097 i18n("KOrganizer/Platform-independent\n") +
1092 "(KO/Pi) " + version + " - " + 1098 "(KO/Pi) " + version + " - " +
1093 1099
1094#ifdef DESKTOP_VERSION 1100#ifdef DESKTOP_VERSION
1095 i18n("Desktop Edition\n") + 1101 i18n("Desktop Edition\n") +
1096#else 1102#else
1097 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1103 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1098#endif 1104#endif
1099 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1105 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );