-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e4c067e..ea9607d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,930 +1,929 @@ | |||
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 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
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 "statusdialog.h" | 110 | #include "statusdialog.h" |
111 | #include "kdatenavigator.h" | 111 | #include "kdatenavigator.h" |
112 | #include "kotodoview.h" | 112 | #include "kotodoview.h" |
113 | #include "datenavigator.h" | 113 | #include "datenavigator.h" |
114 | #include "resourceview.h" | 114 | #include "resourceview.h" |
115 | #include "navigatorbar.h" | 115 | #include "navigatorbar.h" |
116 | #include "searchdialog.h" | 116 | #include "searchdialog.h" |
117 | #include "mainwindow.h" | 117 | #include "mainwindow.h" |
118 | 118 | ||
119 | #include "calendarview.h" | 119 | #include "calendarview.h" |
120 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
121 | #include <qtopia/alarmserver.h> | 121 | #include <qtopia/alarmserver.h> |
122 | #endif | 122 | #endif |
123 | #ifndef _WIN32_ | 123 | #ifndef _WIN32_ |
124 | #include <stdlib.h> | 124 | #include <stdlib.h> |
125 | #include <stdio.h> | 125 | #include <stdio.h> |
126 | #include <unistd.h> | 126 | #include <unistd.h> |
127 | #else | 127 | #else |
128 | #include <qprocess.h> | 128 | #include <qprocess.h> |
129 | #endif | 129 | #endif |
130 | |||
130 | #ifdef DESKTOP_VERSION | 131 | #ifdef DESKTOP_VERSION |
131 | #include <kabc/stdaddressbook.h> | 132 | #include <kabc/stdaddressbook.h> |
132 | #endif | 133 | #endif |
133 | using namespace KOrg; | 134 | using namespace KOrg; |
134 | using namespace KCal; | 135 | using namespace KCal; |
135 | extern int globalFlagBlockAgenda; | 136 | extern int globalFlagBlockAgenda; |
136 | extern int globalFlagBlockStartup; | 137 | extern int globalFlagBlockStartup; |
137 | 138 | ||
138 | 139 | ||
139 | 140 | ||
140 | class KOBeamPrefs : public QDialog | 141 | class KOBeamPrefs : public QDialog |
141 | { | 142 | { |
142 | public: | 143 | public: |
143 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 144 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
144 | QDialog( parent, name, true ) | 145 | QDialog( parent, name, true ) |
145 | { | 146 | { |
146 | setCaption( i18n("Beam Options") ); | 147 | setCaption( i18n("Beam Options") ); |
147 | QVBoxLayout* lay = new QVBoxLayout( this ); | 148 | QVBoxLayout* lay = new QVBoxLayout( this ); |
148 | lay->setSpacing( 3 ); | 149 | lay->setSpacing( 3 ); |
149 | lay->setMargin( 3 ); | 150 | lay->setMargin( 3 ); |
150 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 151 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
151 | lay->addWidget( format ); | 152 | lay->addWidget( format ); |
152 | format->setExclusive ( true ) ; | 153 | format->setExclusive ( true ) ; |
153 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 154 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
154 | lay->addWidget( time ); time->setExclusive ( true ) ; | 155 | lay->addWidget( time ); time->setExclusive ( true ) ; |
155 | vcal = new QRadioButton(" vCalendar ", format ); | 156 | vcal = new QRadioButton(" vCalendar ", format ); |
156 | ical = new QRadioButton(" iCalendar ", format ); | 157 | ical = new QRadioButton(" iCalendar ", format ); |
157 | vcal->setChecked( true ); | 158 | vcal->setChecked( true ); |
158 | tz = new QRadioButton(i18n(" With timezone "), time ); | 159 | tz = new QRadioButton(i18n(" With timezone "), time ); |
159 | local = new QRadioButton(i18n(" Local time "), time ); | 160 | local = new QRadioButton(i18n(" Local time "), time ); |
160 | tz->setChecked( true );#ifdef DESKTOP_VERSION | 161 | tz->setChecked( true ); |
161 | #include <kabc/stdaddressbook.h> | ||
162 | #endif | ||
163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 162 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
164 | lay->addWidget( ok ); | 163 | lay->addWidget( ok ); |
165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 164 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
166 | lay->addWidget( cancel ); | 165 | lay->addWidget( cancel ); |
167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 166 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 167 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
169 | resize( 200, 200 ); | 168 | resize( 200, 200 ); |
170 | } | 169 | } |
171 | 170 | ||
172 | bool beamVcal() { return vcal->isChecked(); } | 171 | bool beamVcal() { return vcal->isChecked(); } |
173 | bool beamLocal() { return local->isChecked(); } | 172 | bool beamLocal() { return local->isChecked(); } |
174 | private: | 173 | private: |
175 | QRadioButton* vcal, *ical, *local, *tz; | 174 | QRadioButton* vcal, *ical, *local, *tz; |
176 | }; | 175 | }; |
177 | class KOCatPrefs : public QDialog | 176 | class KOCatPrefs : public QDialog |
178 | { | 177 | { |
179 | public: | 178 | public: |
180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 179 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
181 | QDialog( parent, name, true ) | 180 | QDialog( parent, name, true ) |
182 | { | 181 | { |
183 | setCaption( i18n("Manage new Categories") ); | 182 | setCaption( i18n("Manage new Categories") ); |
184 | QVBoxLayout* lay = new QVBoxLayout( this ); | 183 | QVBoxLayout* lay = new QVBoxLayout( this ); |
185 | lay->setSpacing( 3 ); | 184 | lay->setSpacing( 3 ); |
186 | lay->setMargin( 3 ); | 185 | lay->setMargin( 3 ); |
187 | 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 ); | 186 | 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 ); |
188 | lay->addWidget( lab ); | 187 | lay->addWidget( lab ); |
189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 188 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
190 | lay->addWidget( format ); | 189 | lay->addWidget( format ); |
191 | format->setExclusive ( true ) ; | 190 | format->setExclusive ( true ) ; |
192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 191 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 192 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
194 | addCatBut->setChecked( true ); | 193 | addCatBut->setChecked( true ); |
195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 194 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
196 | lay->addWidget( ok ); | 195 | lay->addWidget( ok ); |
197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 196 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
198 | lay->addWidget( cancel ); | 197 | lay->addWidget( cancel ); |
199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 198 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 199 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
201 | resize( 200, 200 ); | 200 | resize( 200, 200 ); |
202 | } | 201 | } |
203 | 202 | ||
204 | bool addCat() { return addCatBut->isChecked(); } | 203 | bool addCat() { return addCatBut->isChecked(); } |
205 | private: | 204 | private: |
206 | QRadioButton* addCatBut; | 205 | QRadioButton* addCatBut; |
207 | }; | 206 | }; |
208 | 207 | ||
209 | 208 | ||
210 | 209 | ||
211 | CalendarView::CalendarView( CalendarResources *calendar, | 210 | CalendarView::CalendarView( CalendarResources *calendar, |
212 | QWidget *parent, const char *name ) | 211 | QWidget *parent, const char *name ) |
213 | : CalendarViewBase( parent, name ), | 212 | : CalendarViewBase( parent, name ), |
214 | mCalendar( calendar ), | 213 | mCalendar( calendar ), |
215 | mResourceManager( calendar->resourceManager() ) | 214 | mResourceManager( calendar->resourceManager() ) |
216 | { | 215 | { |
217 | 216 | ||
218 | mEventEditor = 0; | 217 | mEventEditor = 0; |
219 | mTodoEditor = 0; | 218 | mTodoEditor = 0; |
220 | 219 | ||
221 | init(); | 220 | init(); |
222 | } | 221 | } |
223 | 222 | ||
224 | CalendarView::CalendarView( Calendar *calendar, | 223 | CalendarView::CalendarView( Calendar *calendar, |
225 | QWidget *parent, const char *name ) | 224 | QWidget *parent, const char *name ) |
226 | : CalendarViewBase( parent, name ), | 225 | : CalendarViewBase( parent, name ), |
227 | mCalendar( calendar ), | 226 | mCalendar( calendar ), |
228 | mResourceManager( 0 ) | 227 | mResourceManager( 0 ) |
229 | { | 228 | { |
230 | 229 | ||
231 | mEventEditor = 0; | 230 | mEventEditor = 0; |
232 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
233 | init();} | 232 | init();} |
234 | 233 | ||
235 | void CalendarView::init() | 234 | void CalendarView::init() |
236 | { | 235 | { |
237 | beamDialog = new KOBeamPrefs(); | 236 | beamDialog = new KOBeamPrefs(); |
238 | mDatePickerMode = 0; | 237 | mDatePickerMode = 0; |
239 | mCurrentSyncDevice = ""; | 238 | mCurrentSyncDevice = ""; |
240 | writeLocale(); | 239 | writeLocale(); |
241 | mViewManager = new KOViewManager( this ); | 240 | mViewManager = new KOViewManager( this ); |
242 | mDialogManager = new KODialogManager( this ); | 241 | mDialogManager = new KODialogManager( this ); |
243 | mEventViewerDialog = 0; | 242 | mEventViewerDialog = 0; |
244 | mModified = false; | 243 | mModified = false; |
245 | mReadOnly = false; | 244 | mReadOnly = false; |
246 | mSelectedIncidence = 0; | 245 | mSelectedIncidence = 0; |
247 | mCalPrinter = 0; | 246 | mCalPrinter = 0; |
248 | mFilters.setAutoDelete(true); | 247 | mFilters.setAutoDelete(true); |
249 | 248 | ||
250 | mCalendar->registerObserver( this ); | 249 | mCalendar->registerObserver( this ); |
251 | // TODO: Make sure that view is updated, when calendar is changed. | 250 | // TODO: Make sure that view is updated, when calendar is changed. |
252 | 251 | ||
253 | mStorage = new FileStorage( mCalendar ); | 252 | mStorage = new FileStorage( mCalendar ); |
254 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
255 | 254 | ||
256 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
257 | #ifndef KORG_NOSPLITTER | 256 | #ifndef KORG_NOSPLITTER |
258 | // create the main layout frames. | 257 | // create the main layout frames. |
259 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
260 | topLayout->addWidget(mPanner); | 259 | topLayout->addWidget(mPanner); |
261 | 260 | ||
262 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
263 | "CalendarView::LeftFrame"); | 262 | "CalendarView::LeftFrame"); |
264 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
265 | 264 | ||
266 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
267 | "CalendarView::DateNavigator", QDate::currentDate() ); | 266 | "CalendarView::DateNavigator", QDate::currentDate() ); |
268 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
269 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
270 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
271 | 270 | ||
272 | #ifdef KORG_NORESOURCEVIEW | 271 | #ifdef KORG_NORESOURCEVIEW |
273 | mResourceView = 0; | 272 | mResourceView = 0; |
274 | #else | 273 | #else |
275 | if ( mResourceManager ) { | 274 | if ( mResourceManager ) { |
276 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
277 | mResourceView->updateView(); | 276 | mResourceView->updateView(); |
278 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 277 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
279 | SLOT( updateView() ) ); | 278 | SLOT( updateView() ) ); |
280 | } else { | 279 | } else { |
281 | mResourceView = 0; | 280 | mResourceView = 0; |
282 | } | 281 | } |
283 | #endif | 282 | #endif |
284 | QWidget *rightBox = new QWidget( mPanner ); | 283 | QWidget *rightBox = new QWidget( mPanner ); |
285 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
286 | 285 | ||
287 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
288 | rightLayout->addWidget( mNavigatorBar ); | 287 | rightLayout->addWidget( mNavigatorBar ); |
289 | 288 | ||
290 | mRightFrame = new QWidgetStack( rightBox ); | 289 | mRightFrame = new QWidgetStack( rightBox ); |
291 | rightLayout->addWidget( mRightFrame, 1 ); | 290 | rightLayout->addWidget( mRightFrame, 1 ); |
292 | 291 | ||
293 | mLeftFrame = mLeftSplitter; | 292 | mLeftFrame = mLeftSplitter; |
294 | #else | 293 | #else |
295 | QWidget *mainBox = new QWidget( this ); | 294 | QWidget *mainBox = new QWidget( this ); |
296 | QWidget *leftFrame = new QWidget( mainBox ); | 295 | QWidget *leftFrame = new QWidget( mainBox ); |
297 | 296 | ||
298 | QBoxLayout * mainBoxLayout; | 297 | QBoxLayout * mainBoxLayout; |
299 | QBoxLayout * leftFrameLayout; | 298 | QBoxLayout * leftFrameLayout; |
300 | if ( KOPrefs::instance()->mVerticalScreen ) { | 299 | if ( KOPrefs::instance()->mVerticalScreen ) { |
301 | mainBoxLayout = new QVBoxLayout(mainBox); | 300 | mainBoxLayout = new QVBoxLayout(mainBox); |
302 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 301 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
303 | } else { | 302 | } else { |
304 | mainBoxLayout = new QHBoxLayout(mainBox); | 303 | mainBoxLayout = new QHBoxLayout(mainBox); |
305 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
306 | } | 305 | } |
307 | topLayout->addWidget( mainBox ); | 306 | topLayout->addWidget( mainBox ); |
308 | mainBoxLayout->addWidget (leftFrame); | 307 | mainBoxLayout->addWidget (leftFrame); |
309 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
310 | "CalendarView::DateNavigator", QDate::currentDate()); | 309 | "CalendarView::DateNavigator", QDate::currentDate()); |
311 | // mDateNavigator->blockSignals( true ); | 310 | // mDateNavigator->blockSignals( true ); |
312 | leftFrameLayout->addWidget( mDateNavigator ); | 311 | leftFrameLayout->addWidget( mDateNavigator ); |
313 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
314 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); | 313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); |
315 | 314 | ||
316 | if ( QApplication::desktop()->width() < 480 ) { | 315 | if ( QApplication::desktop()->width() < 480 ) { |
317 | leftFrameLayout->addWidget(mFilterView); | 316 | leftFrameLayout->addWidget(mFilterView); |
318 | leftFrameLayout->addWidget(mTodoList, 2 ); | 317 | leftFrameLayout->addWidget(mTodoList, 2 ); |
319 | 318 | ||
320 | } else { | 319 | } else { |
321 | leftFrameLayout->addWidget(mTodoList,2 ); | 320 | leftFrameLayout->addWidget(mTodoList,2 ); |
322 | leftFrameLayout->addWidget(mFilterView ); | 321 | leftFrameLayout->addWidget(mFilterView ); |
323 | } | 322 | } |
324 | mFilterView->hide(); | 323 | mFilterView->hide(); |
325 | QWidget *rightBox = new QWidget( mainBox ); | 324 | QWidget *rightBox = new QWidget( mainBox ); |
326 | mainBoxLayout->addWidget ( rightBox, 10 ); | 325 | mainBoxLayout->addWidget ( rightBox, 10 ); |
327 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
328 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
329 | mRightFrame = new QWidgetStack( rightBox ); | 328 | mRightFrame = new QWidgetStack( rightBox ); |
330 | rightLayout->addWidget( mNavigatorBar ); | 329 | rightLayout->addWidget( mNavigatorBar ); |
331 | rightLayout->addWidget( mRightFrame, 10 ); | 330 | rightLayout->addWidget( mRightFrame, 10 ); |
332 | 331 | ||
333 | mLeftFrame = leftFrame; | 332 | mLeftFrame = leftFrame; |
334 | if ( KOPrefs::instance()->mVerticalScreen ) { | 333 | if ( KOPrefs::instance()->mVerticalScreen ) { |
335 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
337 | } else { | 336 | } else { |
338 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
339 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
340 | } | 339 | } |
341 | 340 | ||
342 | //qDebug("Calendarview Size %d %d ", width(), height()); | 341 | //qDebug("Calendarview Size %d %d ", width(), height()); |
343 | #endif | 342 | #endif |
344 | 343 | ||
345 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
346 | SLOT( showDates( const KCal::DateList & ) ) ); | 345 | SLOT( showDates( const KCal::DateList & ) ) ); |
347 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
348 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
349 | 348 | ||
350 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
351 | mNavigator, SLOT( selectPreviousYear() ) ); | 350 | mNavigator, SLOT( selectPreviousYear() ) ); |
352 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
353 | mNavigator, SLOT( selectNextYear() ) ); | 352 | mNavigator, SLOT( selectNextYear() ) ); |
354 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
355 | mNavigator, SLOT( selectPreviousMonth() ) ); | 354 | mNavigator, SLOT( selectPreviousMonth() ) ); |
356 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
357 | mNavigator, SLOT( selectNextMonth() ) ); | 356 | mNavigator, SLOT( selectNextMonth() ) ); |
358 | 357 | ||
359 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
360 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
361 | 360 | ||
362 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
363 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
364 | 363 | ||
365 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
366 | mNavigator, SLOT( selectPreviousYear() ) ); | 365 | mNavigator, SLOT( selectPreviousYear() ) ); |
367 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 366 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
368 | mNavigator, SLOT( selectNextYear() ) ); | 367 | mNavigator, SLOT( selectNextYear() ) ); |
369 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
370 | mNavigator, SLOT( selectPreviousMonth() ) ); | 369 | mNavigator, SLOT( selectPreviousMonth() ) ); |
371 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
372 | mNavigator, SLOT( selectNextMonth() ) ); | 371 | mNavigator, SLOT( selectNextMonth() ) ); |
373 | 372 | ||
374 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 373 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
375 | mNavigator, SLOT( selectPrevious() ) ); | 374 | mNavigator, SLOT( selectPrevious() ) ); |
376 | connect( mDateNavigator, SIGNAL( goNext() ), | 375 | connect( mDateNavigator, SIGNAL( goNext() ), |
377 | mNavigator, SLOT( selectNext() ) ); | 376 | mNavigator, SLOT( selectNext() ) ); |
378 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
379 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
380 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
381 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
382 | 381 | ||
383 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
384 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
385 | 384 | ||
386 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
387 | SLOT( eventAdded( Event *) ) ); | 386 | SLOT( eventAdded( Event *) ) ); |
388 | 387 | ||
389 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
390 | 389 | ||
391 | connect( this, SIGNAL( configChanged() ), | 390 | connect( this, SIGNAL( configChanged() ), |
392 | mDateNavigator, SLOT( updateConfig() ) ); | 391 | mDateNavigator, SLOT( updateConfig() ) ); |
393 | 392 | ||
394 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 393 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
395 | SLOT( newTodo() ) ); | 394 | SLOT( newTodo() ) ); |
396 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
397 | SLOT( newSubTodo( Todo * ) ) ); | 396 | SLOT( newSubTodo( Todo * ) ) ); |
398 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
399 | SLOT( editTodo( Todo * ) ) ); | 398 | SLOT( editTodo( Todo * ) ) ); |
400 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
401 | SLOT( showTodo( Todo *) ) ); | 400 | SLOT( showTodo( Todo *) ) ); |
402 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
403 | SLOT( deleteTodo( Todo *) ) ); | 402 | SLOT( deleteTodo( Todo *) ) ); |
404 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
405 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
406 | SLOT( purgeCompleted() ) ); | 405 | SLOT( purgeCompleted() ) ); |
407 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
408 | SIGNAL( todoModified( Todo *, int ) ) ); | 407 | SIGNAL( todoModified( Todo *, int ) ) ); |
409 | 408 | ||
410 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
411 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
412 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
413 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 412 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
414 | 413 | ||
415 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
416 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 415 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
417 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
418 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 417 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
419 | 418 | ||
420 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
421 | this, SLOT ( todo_unsub( Todo * ) ) ); | 420 | this, SLOT ( todo_unsub( Todo * ) ) ); |
422 | 421 | ||
423 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 422 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
424 | SLOT( updateTodo( Todo *, int ) ) ); | 423 | SLOT( updateTodo( Todo *, int ) ) ); |
425 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 424 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
426 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 425 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
427 | 426 | ||
428 | 427 | ||
429 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 428 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
430 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 429 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
431 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 430 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
432 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 431 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
433 | 432 | ||
434 | 433 | ||
435 | 434 | ||
436 | 435 | ||
437 | 436 | ||
438 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 437 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
439 | SLOT(checkClipboard())); | 438 | SLOT(checkClipboard())); |
440 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 439 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
441 | SLOT( processTodoListSelection( Incidence * ) ) ); | 440 | SLOT( processTodoListSelection( Incidence * ) ) ); |
442 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 441 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
443 | 442 | ||
444 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 443 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
445 | 444 | ||
446 | mDateFrame = new QVBox(0,0,WType_Popup); | 445 | mDateFrame = new QVBox(0,0,WType_Popup); |
447 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 446 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
448 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 447 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
449 | mDateFrame->setLineWidth(3); | 448 | mDateFrame->setLineWidth(3); |
450 | mDateFrame->hide(); | 449 | mDateFrame->hide(); |
451 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 450 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
452 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 451 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
453 | 452 | ||
454 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 453 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
455 | 454 | ||
456 | mEventEditor = mDialogManager->getEventEditor(); | 455 | mEventEditor = mDialogManager->getEventEditor(); |
457 | mTodoEditor = mDialogManager->getTodoEditor(); | 456 | mTodoEditor = mDialogManager->getTodoEditor(); |
458 | 457 | ||
459 | mFlagEditDescription = false; | 458 | mFlagEditDescription = false; |
460 | 459 | ||
461 | mSuspendTimer = new QTimer( this ); | 460 | mSuspendTimer = new QTimer( this ); |
462 | mAlarmTimer = new QTimer( this ); | 461 | mAlarmTimer = new QTimer( this ); |
463 | mRecheckAlarmTimer = new QTimer( this ); | 462 | mRecheckAlarmTimer = new QTimer( this ); |
464 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 463 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
465 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 464 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
466 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 465 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
467 | mAlarmDialog = new AlarmDialog( this ); | 466 | mAlarmDialog = new AlarmDialog( this ); |
468 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 467 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
469 | mAlarmDialog->setServerNotification( false ); | 468 | mAlarmDialog->setServerNotification( false ); |
470 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 469 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
471 | 470 | ||
472 | 471 | ||
473 | #ifndef DESKTOP_VERSION | 472 | #ifndef DESKTOP_VERSION |
474 | //US listen for arriving address resultsets | 473 | //US listen for arriving address resultsets |
475 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 474 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
476 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 475 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
477 | #endif | 476 | #endif |
478 | 477 | ||
479 | } | 478 | } |
480 | 479 | ||
481 | 480 | ||
482 | CalendarView::~CalendarView() | 481 | CalendarView::~CalendarView() |
483 | { | 482 | { |
484 | // kdDebug() << "~CalendarView()" << endl; | 483 | // kdDebug() << "~CalendarView()" << endl; |
485 | //qDebug("CalendarView::~CalendarView() "); | 484 | //qDebug("CalendarView::~CalendarView() "); |
486 | delete mDialogManager; | 485 | delete mDialogManager; |
487 | delete mViewManager; | 486 | delete mViewManager; |
488 | delete mStorage; | 487 | delete mStorage; |
489 | delete mDateFrame ; | 488 | delete mDateFrame ; |
490 | delete beamDialog; | 489 | delete beamDialog; |
491 | //kdDebug() << "~CalendarView() done" << endl; | 490 | //kdDebug() << "~CalendarView() done" << endl; |
492 | } | 491 | } |
493 | void CalendarView::timerAlarm() | 492 | void CalendarView::timerAlarm() |
494 | { | 493 | { |
495 | //qDebug("CalendarView::timerAlarm() "); | 494 | //qDebug("CalendarView::timerAlarm() "); |
496 | computeAlarm(mAlarmNotification ); | 495 | computeAlarm(mAlarmNotification ); |
497 | } | 496 | } |
498 | 497 | ||
499 | void CalendarView::suspendAlarm() | 498 | void CalendarView::suspendAlarm() |
500 | { | 499 | { |
501 | //qDebug(" CalendarView::suspendAlarm() "); | 500 | //qDebug(" CalendarView::suspendAlarm() "); |
502 | computeAlarm(mSuspendAlarmNotification ); | 501 | computeAlarm(mSuspendAlarmNotification ); |
503 | 502 | ||
504 | } | 503 | } |
505 | 504 | ||
506 | void CalendarView::startAlarm( QString mess , QString filename) | 505 | void CalendarView::startAlarm( QString mess , QString filename) |
507 | { | 506 | { |
508 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 507 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
509 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 508 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
510 | 509 | ||
511 | } | 510 | } |
512 | 511 | ||
513 | void CalendarView::checkNextTimerAlarm() | 512 | void CalendarView::checkNextTimerAlarm() |
514 | { | 513 | { |
515 | mCalendar->checkAlarmForIncidence( 0, true ); | 514 | mCalendar->checkAlarmForIncidence( 0, true ); |
516 | } | 515 | } |
517 | 516 | ||
518 | void CalendarView::computeAlarm( QString msg ) | 517 | void CalendarView::computeAlarm( QString msg ) |
519 | { | 518 | { |
520 | 519 | ||
521 | QString mess = msg; | 520 | QString mess = msg; |
522 | QString mAlarmMessage = mess.mid( 9 ); | 521 | QString mAlarmMessage = mess.mid( 9 ); |
523 | QString filename = MainWindow::resourcePath(); | 522 | QString filename = MainWindow::resourcePath(); |
524 | filename += "koalarm.wav"; | 523 | filename += "koalarm.wav"; |
525 | QString tempfilename; | 524 | QString tempfilename; |
526 | if ( mess.left( 13 ) == "suspend_alarm") { | 525 | if ( mess.left( 13 ) == "suspend_alarm") { |
527 | bool error = false; | 526 | bool error = false; |
528 | int len = mess.mid( 13 ).find("+++"); | 527 | int len = mess.mid( 13 ).find("+++"); |
529 | if ( len < 2 ) | 528 | if ( len < 2 ) |
530 | error = true; | 529 | error = true; |
531 | else { | 530 | else { |
532 | tempfilename = mess.mid( 13, len ); | 531 | tempfilename = mess.mid( 13, len ); |
533 | if ( !QFile::exists( tempfilename ) ) | 532 | if ( !QFile::exists( tempfilename ) ) |
534 | error = true; | 533 | error = true; |
535 | } | 534 | } |
536 | if ( ! error ) { | 535 | if ( ! error ) { |
537 | filename = tempfilename; | 536 | filename = tempfilename; |
538 | } | 537 | } |
539 | mAlarmMessage = mess.mid( 13+len+3 ); | 538 | mAlarmMessage = mess.mid( 13+len+3 ); |
540 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 539 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
541 | startAlarm( mAlarmMessage, filename); | 540 | startAlarm( mAlarmMessage, filename); |
542 | return; | 541 | return; |
543 | } | 542 | } |
544 | if ( mess.left( 11 ) == "timer_alarm") { | 543 | if ( mess.left( 11 ) == "timer_alarm") { |
545 | //mTimerTime = 0; | 544 | //mTimerTime = 0; |
546 | startAlarm( mess.mid( 11 ), filename ); | 545 | startAlarm( mess.mid( 11 ), filename ); |
547 | return; | 546 | return; |
548 | } | 547 | } |
549 | if ( mess.left( 10 ) == "proc_alarm") { | 548 | if ( mess.left( 10 ) == "proc_alarm") { |
550 | bool error = false; | 549 | bool error = false; |
551 | int len = mess.mid( 10 ).find("+++"); | 550 | int len = mess.mid( 10 ).find("+++"); |
552 | if ( len < 2 ) | 551 | if ( len < 2 ) |
553 | error = true; | 552 | error = true; |
554 | else { | 553 | else { |
555 | tempfilename = mess.mid( 10, len ); | 554 | tempfilename = mess.mid( 10, len ); |
556 | if ( !QFile::exists( tempfilename ) ) | 555 | if ( !QFile::exists( tempfilename ) ) |
557 | error = true; | 556 | error = true; |
558 | } | 557 | } |
559 | if ( error ) { | 558 | if ( error ) { |
560 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 559 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
561 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 560 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
562 | } else { | 561 | } else { |
563 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 562 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
564 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 563 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
565 | #ifndef _WIN32_ | 564 | #ifndef _WIN32_ |
566 | if ( vfork () == 0 ) { | 565 | if ( vfork () == 0 ) { |
567 | execl ( tempfilename.latin1(), 0 ); | 566 | execl ( tempfilename.latin1(), 0 ); |
568 | return; | 567 | return; |
569 | } | 568 | } |
570 | #else | 569 | #else |
571 | QProcess* p = new QProcess(); | 570 | QProcess* p = new QProcess(); |
572 | p->addArgument( tempfilename.latin1() ); | 571 | p->addArgument( tempfilename.latin1() ); |
573 | p->start(); | 572 | p->start(); |
574 | return; | 573 | return; |
575 | #endif | 574 | #endif |
576 | 575 | ||
577 | return; | 576 | return; |
578 | } | 577 | } |
579 | 578 | ||
580 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 579 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
581 | } | 580 | } |
582 | if ( mess.left( 11 ) == "audio_alarm") { | 581 | if ( mess.left( 11 ) == "audio_alarm") { |
583 | bool error = false; | 582 | bool error = false; |
584 | int len = mess.mid( 11 ).find("+++"); | 583 | int len = mess.mid( 11 ).find("+++"); |
585 | if ( len < 2 ) | 584 | if ( len < 2 ) |
586 | error = true; | 585 | error = true; |
587 | else { | 586 | else { |
588 | tempfilename = mess.mid( 11, len ); | 587 | tempfilename = mess.mid( 11, len ); |
589 | if ( !QFile::exists( tempfilename ) ) | 588 | if ( !QFile::exists( tempfilename ) ) |
590 | error = true; | 589 | error = true; |
591 | } | 590 | } |
592 | if ( ! error ) { | 591 | if ( ! error ) { |
593 | filename = tempfilename; | 592 | filename = tempfilename; |
594 | } | 593 | } |
595 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 594 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
596 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 595 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
597 | } | 596 | } |
598 | if ( mess.left( 9 ) == "cal_alarm") { | 597 | if ( mess.left( 9 ) == "cal_alarm") { |
599 | mAlarmMessage = mess.mid( 9 ) ; | 598 | mAlarmMessage = mess.mid( 9 ) ; |
600 | } | 599 | } |
601 | 600 | ||
602 | startAlarm( mAlarmMessage, filename ); | 601 | startAlarm( mAlarmMessage, filename ); |
603 | 602 | ||
604 | 603 | ||
605 | } | 604 | } |
606 | 605 | ||
607 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 606 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
608 | { | 607 | { |
609 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 608 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
610 | 609 | ||
611 | mSuspendAlarmNotification = noti; | 610 | mSuspendAlarmNotification = noti; |
612 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 611 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
613 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 612 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
614 | mSuspendTimer->start( ms , true ); | 613 | mSuspendTimer->start( ms , true ); |
615 | 614 | ||
616 | } | 615 | } |
617 | 616 | ||
618 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 617 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
619 | { | 618 | { |
620 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 619 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
621 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 620 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
622 | #ifndef DESKTOP_VERSION | 621 | #ifndef DESKTOP_VERSION |
623 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 622 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
624 | #endif | 623 | #endif |
625 | return; | 624 | return; |
626 | } | 625 | } |
627 | int maxSec; | 626 | int maxSec; |
628 | //maxSec = 5; //testing only | 627 | //maxSec = 5; //testing only |
629 | maxSec = 86400+3600; // one day+1hour | 628 | maxSec = 86400+3600; // one day+1hour |
630 | mAlarmNotification = noti; | 629 | mAlarmNotification = noti; |
631 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 630 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
632 | if ( sec > maxSec ) { | 631 | if ( sec > maxSec ) { |
633 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 632 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
634 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 633 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
635 | return; | 634 | return; |
636 | } else { | 635 | } else { |
637 | mRecheckAlarmTimer->stop(); | 636 | mRecheckAlarmTimer->stop(); |
638 | } | 637 | } |
639 | //qDebug("Alarm timer started with secs: %d ", sec); | 638 | //qDebug("Alarm timer started with secs: %d ", sec); |
640 | mAlarmTimer->start( sec *1000 , true ); | 639 | mAlarmTimer->start( sec *1000 , true ); |
641 | 640 | ||
642 | } | 641 | } |
643 | // called by mRecheckAlarmTimer to get next alarm | 642 | // called by mRecheckAlarmTimer to get next alarm |
644 | // we need this, because a QTimer has only a max range of 25 days | 643 | // we need this, because a QTimer has only a max range of 25 days |
645 | void CalendarView::recheckTimerAlarm() | 644 | void CalendarView::recheckTimerAlarm() |
646 | { | 645 | { |
647 | mAlarmTimer->stop(); | 646 | mAlarmTimer->stop(); |
648 | mRecheckAlarmTimer->stop(); | 647 | mRecheckAlarmTimer->stop(); |
649 | mCalendar->checkAlarmForIncidence( 0, true ); | 648 | mCalendar->checkAlarmForIncidence( 0, true ); |
650 | } | 649 | } |
651 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 650 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
652 | { | 651 | { |
653 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 652 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
654 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 653 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
655 | #ifndef DESKTOP_VERSION | 654 | #ifndef DESKTOP_VERSION |
656 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 655 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
657 | #endif | 656 | #endif |
658 | return; | 657 | return; |
659 | } | 658 | } |
660 | mAlarmTimer->stop(); | 659 | mAlarmTimer->stop(); |
661 | } | 660 | } |
662 | void CalendarView::selectWeekNum ( int num ) | 661 | void CalendarView::selectWeekNum ( int num ) |
663 | { | 662 | { |
664 | dateNavigator()->selectWeek( num ); | 663 | dateNavigator()->selectWeek( num ); |
665 | mViewManager->showWeekView(); | 664 | mViewManager->showWeekView(); |
666 | } | 665 | } |
667 | KOViewManager *CalendarView::viewManager() | 666 | KOViewManager *CalendarView::viewManager() |
668 | { | 667 | { |
669 | return mViewManager; | 668 | return mViewManager; |
670 | } | 669 | } |
671 | 670 | ||
672 | KODialogManager *CalendarView::dialogManager() | 671 | KODialogManager *CalendarView::dialogManager() |
673 | { | 672 | { |
674 | return mDialogManager; | 673 | return mDialogManager; |
675 | } | 674 | } |
676 | 675 | ||
677 | QDate CalendarView::startDate() | 676 | QDate CalendarView::startDate() |
678 | { | 677 | { |
679 | DateList dates = mNavigator->selectedDates(); | 678 | DateList dates = mNavigator->selectedDates(); |
680 | 679 | ||
681 | return dates.first(); | 680 | return dates.first(); |
682 | } | 681 | } |
683 | 682 | ||
684 | QDate CalendarView::endDate() | 683 | QDate CalendarView::endDate() |
685 | { | 684 | { |
686 | DateList dates = mNavigator->selectedDates(); | 685 | DateList dates = mNavigator->selectedDates(); |
687 | 686 | ||
688 | return dates.last(); | 687 | return dates.last(); |
689 | } | 688 | } |
690 | 689 | ||
691 | 690 | ||
692 | void CalendarView::createPrinter() | 691 | void CalendarView::createPrinter() |
693 | { | 692 | { |
694 | #ifndef KORG_NOPRINTER | 693 | #ifndef KORG_NOPRINTER |
695 | if (!mCalPrinter) { | 694 | if (!mCalPrinter) { |
696 | mCalPrinter = new CalPrinter(this, mCalendar); | 695 | mCalPrinter = new CalPrinter(this, mCalendar); |
697 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 696 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
698 | } | 697 | } |
699 | #endif | 698 | #endif |
700 | } | 699 | } |
701 | 700 | ||
702 | void CalendarView::confSync() | 701 | void CalendarView::confSync() |
703 | { | 702 | { |
704 | static KSyncPrefsDialog* sp = 0; | 703 | static KSyncPrefsDialog* sp = 0; |
705 | if ( ! sp ) { | 704 | if ( ! sp ) { |
706 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); | 705 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); |
707 | } | 706 | } |
708 | sp->usrReadConfig(); | 707 | sp->usrReadConfig(); |
709 | #ifndef DESKTOP_VERSION | 708 | #ifndef DESKTOP_VERSION |
710 | sp->showMaximized(); | 709 | sp->showMaximized(); |
711 | #else | 710 | #else |
712 | sp->show(); | 711 | sp->show(); |
713 | #endif | 712 | #endif |
714 | sp->exec(); | 713 | sp->exec(); |
715 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 714 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
716 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 715 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
717 | } | 716 | } |
718 | 717 | ||
719 | 718 | ||
720 | //KOPrefs::instance()->mWriteBackFile | 719 | //KOPrefs::instance()->mWriteBackFile |
721 | //KOPrefs::instance()->mWriteBackExistingOnly | 720 | //KOPrefs::instance()->mWriteBackExistingOnly |
722 | 721 | ||
723 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 722 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
724 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 723 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
725 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 724 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
726 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 725 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
727 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 726 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
728 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 727 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
729 | 728 | ||
730 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 729 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
731 | { | 730 | { |
732 | 731 | ||
733 | //void setZaurusId(int id); | 732 | //void setZaurusId(int id); |
734 | // int zaurusId() const; | 733 | // int zaurusId() const; |
735 | // void setZaurusUid(int id); | 734 | // void setZaurusUid(int id); |
736 | // int zaurusUid() const; | 735 | // int zaurusUid() const; |
737 | // void setZaurusStat(int id); | 736 | // void setZaurusStat(int id); |
738 | // int zaurusStat() const; | 737 | // int zaurusStat() const; |
739 | // 0 equal | 738 | // 0 equal |
740 | // 1 take local | 739 | // 1 take local |
741 | // 2 take remote | 740 | // 2 take remote |
742 | // 3 cancel | 741 | // 3 cancel |
743 | QDateTime lastSync = mLastCalendarSync; | 742 | QDateTime lastSync = mLastCalendarSync; |
744 | QDateTime localMod = local->lastModified(); | 743 | QDateTime localMod = local->lastModified(); |
745 | QDateTime remoteMod = remote->lastModified(); | 744 | QDateTime remoteMod = remote->lastModified(); |
746 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 745 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
747 | bool remCh, locCh; | 746 | bool remCh, locCh; |
748 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 747 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
749 | //if ( remCh ) | 748 | //if ( remCh ) |
750 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 749 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
751 | locCh = ( localMod > mLastCalendarSync ); | 750 | locCh = ( localMod > mLastCalendarSync ); |
752 | if ( !remCh && ! locCh ) { | 751 | if ( !remCh && ! locCh ) { |
753 | //qDebug("both not changed "); | 752 | //qDebug("both not changed "); |
754 | lastSync = localMod.addDays(1); | 753 | lastSync = localMod.addDays(1); |
755 | if ( mode <= SYNC_PREF_ASK ) | 754 | if ( mode <= SYNC_PREF_ASK ) |
756 | return 0; | 755 | return 0; |
757 | } else { | 756 | } else { |
758 | if ( locCh ) { | 757 | if ( locCh ) { |
759 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 758 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
760 | lastSync = localMod.addDays( -1 ); | 759 | lastSync = localMod.addDays( -1 ); |
761 | if ( !remCh ) | 760 | if ( !remCh ) |
762 | remoteMod = ( lastSync.addDays( -1 ) ); | 761 | remoteMod = ( lastSync.addDays( -1 ) ); |
763 | } else { | 762 | } else { |
764 | //qDebug(" not loc changed "); | 763 | //qDebug(" not loc changed "); |
765 | lastSync = localMod.addDays( 1 ); | 764 | lastSync = localMod.addDays( 1 ); |
766 | if ( remCh ) | 765 | if ( remCh ) |
767 | remoteMod =( lastSync.addDays( 1 ) ); | 766 | remoteMod =( lastSync.addDays( 1 ) ); |
768 | 767 | ||
769 | } | 768 | } |
770 | } | 769 | } |
771 | full = true; | 770 | full = true; |
772 | if ( mode < SYNC_PREF_ASK ) | 771 | if ( mode < SYNC_PREF_ASK ) |
773 | mode = SYNC_PREF_ASK; | 772 | mode = SYNC_PREF_ASK; |
774 | } else { | 773 | } else { |
775 | if ( localMod == remoteMod ) | 774 | if ( localMod == remoteMod ) |
776 | if ( local->revision() == remote->revision() ) | 775 | if ( local->revision() == remote->revision() ) |
777 | return 0; | 776 | return 0; |
778 | 777 | ||
779 | } | 778 | } |
780 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 779 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
781 | 780 | ||
782 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 781 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
783 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 782 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
784 | //full = true; //debug only | 783 | //full = true; //debug only |
785 | if ( full ) { | 784 | if ( full ) { |
786 | bool equ = false; | 785 | bool equ = false; |
787 | if ( local->type() == "Event" ) { | 786 | if ( local->type() == "Event" ) { |
788 | equ = (*((Event*) local) == *((Event*) remote)); | 787 | equ = (*((Event*) local) == *((Event*) remote)); |
789 | } | 788 | } |
790 | else if ( local->type() =="Todo" ) | 789 | else if ( local->type() =="Todo" ) |
791 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 790 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
792 | else if ( local->type() =="Journal" ) | 791 | else if ( local->type() =="Journal" ) |
793 | equ = (*((Journal*) local) == *((Journal*) remote)); | 792 | equ = (*((Journal*) local) == *((Journal*) remote)); |
794 | if ( equ ) { | 793 | if ( equ ) { |
795 | //qDebug("equal "); | 794 | //qDebug("equal "); |
796 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 795 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
797 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 796 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
798 | } | 797 | } |
799 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 798 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
800 | return 0; | 799 | return 0; |
801 | 800 | ||
802 | }//else //debug only | 801 | }//else //debug only |
803 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 802 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
804 | } | 803 | } |
805 | int result; | 804 | int result; |
806 | bool localIsNew; | 805 | bool localIsNew; |
807 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 806 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
808 | 807 | ||
809 | if ( full && mode < SYNC_PREF_NEWEST ) | 808 | if ( full && mode < SYNC_PREF_NEWEST ) |
810 | mode = SYNC_PREF_ASK; | 809 | mode = SYNC_PREF_ASK; |
811 | 810 | ||
812 | switch( mode ) { | 811 | switch( mode ) { |
813 | case SYNC_PREF_LOCAL: | 812 | case SYNC_PREF_LOCAL: |
814 | if ( lastSync > remoteMod ) | 813 | if ( lastSync > remoteMod ) |
815 | return 1; | 814 | return 1; |
816 | if ( lastSync > localMod ) | 815 | if ( lastSync > localMod ) |
817 | return 2; | 816 | return 2; |
818 | return 1; | 817 | return 1; |
819 | break; | 818 | break; |
820 | case SYNC_PREF_REMOTE: | 819 | case SYNC_PREF_REMOTE: |
821 | if ( lastSync > remoteMod ) | 820 | if ( lastSync > remoteMod ) |
822 | return 1; | 821 | return 1; |
823 | if ( lastSync > localMod ) | 822 | if ( lastSync > localMod ) |
824 | return 2; | 823 | return 2; |
825 | return 2; | 824 | return 2; |
826 | break; | 825 | break; |
827 | case SYNC_PREF_NEWEST: | 826 | case SYNC_PREF_NEWEST: |
828 | if ( localMod > remoteMod ) | 827 | if ( localMod > remoteMod ) |
829 | return 1; | 828 | return 1; |
830 | else | 829 | else |
831 | return 2; | 830 | return 2; |
832 | break; | 831 | break; |
833 | case SYNC_PREF_ASK: | 832 | case SYNC_PREF_ASK: |
834 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 833 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
835 | if ( lastSync > remoteMod ) | 834 | if ( lastSync > remoteMod ) |
836 | return 1; | 835 | return 1; |
837 | if ( lastSync > localMod ) | 836 | if ( lastSync > localMod ) |
838 | return 2; | 837 | return 2; |
839 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 838 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
840 | localIsNew = localMod >= remoteMod; | 839 | localIsNew = localMod >= remoteMod; |
841 | if ( localIsNew ) | 840 | if ( localIsNew ) |
842 | getEventViewerDialog()->setColorMode( 1 ); | 841 | getEventViewerDialog()->setColorMode( 1 ); |
843 | else | 842 | else |
844 | getEventViewerDialog()->setColorMode( 2 ); | 843 | getEventViewerDialog()->setColorMode( 2 ); |
845 | getEventViewerDialog()->setIncidence(local); | 844 | getEventViewerDialog()->setIncidence(local); |
846 | if ( localIsNew ) | 845 | if ( localIsNew ) |
847 | getEventViewerDialog()->setColorMode( 2 ); | 846 | getEventViewerDialog()->setColorMode( 2 ); |
848 | else | 847 | else |
849 | getEventViewerDialog()->setColorMode( 1 ); | 848 | getEventViewerDialog()->setColorMode( 1 ); |
850 | getEventViewerDialog()->addIncidence(remote); | 849 | getEventViewerDialog()->addIncidence(remote); |
851 | getEventViewerDialog()->setColorMode( 0 ); | 850 | getEventViewerDialog()->setColorMode( 0 ); |
852 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 851 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
853 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 852 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
854 | getEventViewerDialog()->showMe(); | 853 | getEventViewerDialog()->showMe(); |
855 | result = getEventViewerDialog()->executeS( localIsNew ); | 854 | result = getEventViewerDialog()->executeS( localIsNew ); |
856 | return result; | 855 | return result; |
857 | 856 | ||
858 | break; | 857 | break; |
859 | case SYNC_PREF_FORCE_LOCAL: | 858 | case SYNC_PREF_FORCE_LOCAL: |
860 | return 1; | 859 | return 1; |
861 | break; | 860 | break; |
862 | case SYNC_PREF_FORCE_REMOTE: | 861 | case SYNC_PREF_FORCE_REMOTE: |
863 | return 2; | 862 | return 2; |
864 | break; | 863 | break; |
865 | 864 | ||
866 | default: | 865 | default: |
867 | // SYNC_PREF_TAKE_BOTH not implemented | 866 | // SYNC_PREF_TAKE_BOTH not implemented |
868 | break; | 867 | break; |
869 | } | 868 | } |
870 | return 0; | 869 | return 0; |
871 | } | 870 | } |
872 | Event* CalendarView::getLastSyncEvent() | 871 | Event* CalendarView::getLastSyncEvent() |
873 | { | 872 | { |
874 | Event* lse; | 873 | Event* lse; |
875 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 874 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
876 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 875 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
877 | if (!lse) { | 876 | if (!lse) { |
878 | lse = new Event(); | 877 | lse = new Event(); |
879 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 878 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
880 | QString sum = ""; | 879 | QString sum = ""; |
881 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 880 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
882 | sum = "E: "; | 881 | sum = "E: "; |
883 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 882 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
884 | lse->setDtStart( mLastCalendarSync ); | 883 | lse->setDtStart( mLastCalendarSync ); |
885 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 884 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
886 | lse->setCategories( i18n("SyncEvent") ); | 885 | lse->setCategories( i18n("SyncEvent") ); |
887 | lse->setReadOnly( true ); | 886 | lse->setReadOnly( true ); |
888 | mCalendar->addEvent( lse ); | 887 | mCalendar->addEvent( lse ); |
889 | } | 888 | } |
890 | 889 | ||
891 | return lse; | 890 | return lse; |
892 | 891 | ||
893 | } | 892 | } |
894 | 893 | ||
895 | // we check, if the to delete event has a id for a profile | 894 | // we check, if the to delete event has a id for a profile |
896 | // if yes, we set this id in the profile to delete | 895 | // if yes, we set this id in the profile to delete |
897 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 896 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
898 | { | 897 | { |
899 | if ( lastSync.count() == 0 ) { | 898 | if ( lastSync.count() == 0 ) { |
900 | //qDebug(" lastSync.count() == 0"); | 899 | //qDebug(" lastSync.count() == 0"); |
901 | return; | 900 | return; |
902 | } | 901 | } |
903 | if ( toDelete->type() == "Journal" ) | 902 | if ( toDelete->type() == "Journal" ) |
904 | return; | 903 | return; |
905 | 904 | ||
906 | Event* eve = lastSync.first(); | 905 | Event* eve = lastSync.first(); |
907 | 906 | ||
908 | while ( eve ) { | 907 | while ( eve ) { |
909 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 908 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
910 | if ( !id.isEmpty() ) { | 909 | if ( !id.isEmpty() ) { |
911 | QString des = eve->description(); | 910 | QString des = eve->description(); |
912 | QString pref = "e"; | 911 | QString pref = "e"; |
913 | if ( toDelete->type() == "Todo" ) | 912 | if ( toDelete->type() == "Todo" ) |
914 | pref = "t"; | 913 | pref = "t"; |
915 | des += pref+ id + ","; | 914 | des += pref+ id + ","; |
916 | eve->setReadOnly( false ); | 915 | eve->setReadOnly( false ); |
917 | eve->setDescription( des ); | 916 | eve->setDescription( des ); |
918 | //qDebug("setdes %s ", des.latin1()); | 917 | //qDebug("setdes %s ", des.latin1()); |
919 | eve->setReadOnly( true ); | 918 | eve->setReadOnly( true ); |
920 | } | 919 | } |
921 | eve = lastSync.next(); | 920 | eve = lastSync.next(); |
922 | } | 921 | } |
923 | 922 | ||
924 | } | 923 | } |
925 | void CalendarView::checkExternalId( Incidence * inc ) | 924 | void CalendarView::checkExternalId( Incidence * inc ) |
926 | { | 925 | { |
927 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 926 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
928 | checkExternSyncEvent( lastSync, inc ); | 927 | checkExternSyncEvent( lastSync, inc ); |
929 | 928 | ||
930 | } | 929 | } |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index ea543dd..b360644 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1,990 +1,1000 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include "ksyncmanager.h" | 23 | #include "ksyncmanager.h" |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
32 | #include "ksyncprofile.h" | 32 | #include "ksyncprofile.h" |
33 | #include "ksyncprefsdialog.h" | 33 | #include "ksyncprefsdialog.h" |
34 | #include "kpimprefs.h" | 34 | #include "kpimprefs.h" |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <qbuttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | 51 | ||
52 | #include <klocale.h> | 52 | #include <klocale.h> |
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kconfig.h> | 54 | #include <kconfig.h> |
55 | #include <kfiledialog.h> | 55 | #include <kfiledialog.h> |
56 | 56 | ||
57 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 57 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) |
58 | : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) | 58 | : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) |
59 | { | 59 | { |
60 | mServerSocket = 0; | 60 | mServerSocket = 0; |
61 | bar = new QProgressBar ( 1, 0 ); | 61 | bar = new QProgressBar ( 1, 0 ); |
62 | bar->setCaption (""); | 62 | bar->setCaption (""); |
63 | 63 | ||
64 | int w = 300; | 64 | int w = 300; |
65 | if ( QApplication::desktop()->width() < 320 ) | 65 | if ( QApplication::desktop()->width() < 320 ) |
66 | w = 220; | 66 | w = 220; |
67 | int h = bar->sizeHint().height() ; | 67 | int h = bar->sizeHint().height() ; |
68 | int dw = QApplication::desktop()->width(); | 68 | int dw = QApplication::desktop()->width(); |
69 | int dh = QApplication::desktop()->height(); | 69 | int dh = QApplication::desktop()->height(); |
70 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 70 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | KSyncManager::~KSyncManager() | 74 | KSyncManager::~KSyncManager() |
75 | { | 75 | { |
76 | delete bar; | 76 | delete bar; |
77 | } | 77 | } |
78 | 78 | ||
79 | //LR ok | 79 | //LR ok |
80 | void KSyncManager::fillSyncMenu() | 80 | void KSyncManager::fillSyncMenu() |
81 | { | 81 | { |
82 | if ( mSyncMenu->count() ) | 82 | if ( mSyncMenu->count() ) |
83 | mSyncMenu->clear(); | 83 | mSyncMenu->clear(); |
84 | 84 | ||
85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
86 | mSyncMenu->insertSeparator(); | 86 | mSyncMenu->insertSeparator(); |
87 | if ( mServerSocket == 0 ) { | 87 | if ( mServerSocket == 0 ) { |
88 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 88 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
89 | } else { | 89 | } else { |
90 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 90 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
91 | } | 91 | } |
92 | mSyncMenu->insertSeparator(); | 92 | mSyncMenu->insertSeparator(); |
93 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); | 93 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); |
94 | mSyncMenu->insertSeparator(); | 94 | mSyncMenu->insertSeparator(); |
95 | 95 | ||
96 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 96 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
97 | config.setGroup("General"); | 97 | config.setGroup("General"); |
98 | QStringList prof = config.readListEntry("SyncProfileNames"); | 98 | QStringList prof = config.readListEntry("SyncProfileNames"); |
99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
100 | if ( prof.count() < 2 ) { | 100 | if ( prof.count() < 2 ) { |
101 | prof.clear(); | 101 | prof.clear(); |
102 | prof << i18n("Sharp_DTM"); | 102 | prof << i18n("Sharp_DTM"); |
103 | prof << i18n("Local_file"); | 103 | prof << i18n("Local_file"); |
104 | KSyncProfile* temp = new KSyncProfile (); | 104 | KSyncProfile* temp = new KSyncProfile (); |
105 | temp->setName( prof[0] ); | 105 | temp->setName( prof[0] ); |
106 | temp->writeConfig(&config); | 106 | temp->writeConfig(&config); |
107 | temp->setName( prof[1] ); | 107 | temp->setName( prof[1] ); |
108 | temp->writeConfig(&config); | 108 | temp->writeConfig(&config); |
109 | config.setGroup("General"); | 109 | config.setGroup("General"); |
110 | config.writeEntry("SyncProfileNames",prof); | 110 | config.writeEntry("SyncProfileNames",prof); |
111 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 111 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
112 | config.sync(); | 112 | config.sync(); |
113 | delete temp; | 113 | delete temp; |
114 | } | 114 | } |
115 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 115 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
116 | mSyncProfileNames = prof; | 116 | mSyncProfileNames = prof; |
117 | unsigned int i; | 117 | unsigned int i; |
118 | for ( i = 0; i < prof.count(); ++i ) { | 118 | for ( i = 0; i < prof.count(); ++i ) { |
119 | mSyncMenu->insertItem( prof[i], 1000+i ); | 119 | mSyncMenu->insertItem( prof[i], 1000+i ); |
120 | if ( i == 2 ) | 120 | if ( i == 2 ) |
121 | mSyncMenu->insertSeparator(); | 121 | mSyncMenu->insertSeparator(); |
122 | } | 122 | } |
123 | QDir app_dir; | 123 | QDir app_dir; |
124 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 124 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
125 | if ( mTargetApp == PWMPI) { | 125 | if ( mTargetApp == PWMPI) { |
126 | mSyncMenu->removeItem( 1000 ); | 126 | mSyncMenu->removeItem( 1000 ); |
127 | } | 127 | } |
128 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 128 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
129 | mSyncMenu->setItemEnabled( 1000, false ); | 129 | mSyncMenu->setItemEnabled( 1000, false ); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | void KSyncManager::slotSyncMenu( int action ) | 133 | void KSyncManager::slotSyncMenu( int action ) |
134 | { | 134 | { |
135 | //qDebug("syncaction %d ", action); | 135 | //qDebug("syncaction %d ", action); |
136 | if ( action == 0 ) { | 136 | if ( action == 0 ) { |
137 | 137 | ||
138 | // seems to be a Qt2 event handling bug | 138 | // seems to be a Qt2 event handling bug |
139 | // syncmenu.clear causes a segfault at first time | 139 | // syncmenu.clear causes a segfault at first time |
140 | // when we call it after the main event loop, it is ok | 140 | // when we call it after the main event loop, it is ok |
141 | // same behaviour when calling OM/Pi via QCOP for the first time | 141 | // same behaviour when calling OM/Pi via QCOP for the first time |
142 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | 142 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); |
143 | //confSync(); | 143 | //confSync(); |
144 | 144 | ||
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | if ( action == 1 ) { | 147 | if ( action == 1 ) { |
148 | multiSync( true ); | 148 | multiSync( true ); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | if ( action == 2 ) { | 151 | if ( action == 2 ) { |
152 | enableQuick(); | 152 | enableQuick(); |
153 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 153 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | if ( action == 3 ) { | 156 | if ( action == 3 ) { |
157 | delete mServerSocket; | 157 | delete mServerSocket; |
158 | mServerSocket = 0; | 158 | mServerSocket = 0; |
159 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 159 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
160 | return; | 160 | return; |
161 | } | 161 | } |
162 | 162 | ||
163 | if (blockSave()) | 163 | if (blockSave()) |
164 | return; | 164 | return; |
165 | 165 | ||
166 | setBlockSave(true); | 166 | setBlockSave(true); |
167 | 167 | ||
168 | mCurrentSyncProfile = action - 1000 ; | 168 | mCurrentSyncProfile = action - 1000 ; |
169 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 169 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
170 | mCurrentSyncName = mLocalMachineName ; | 170 | mCurrentSyncName = mLocalMachineName ; |
171 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 171 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
172 | KSyncProfile* temp = new KSyncProfile (); | 172 | KSyncProfile* temp = new KSyncProfile (); |
173 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 173 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
174 | temp->readConfig(&config); | 174 | temp->readConfig(&config); |
175 | mAskForPreferences = temp->getAskForPreferences(); | 175 | mAskForPreferences = temp->getAskForPreferences(); |
176 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 176 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
177 | mWriteBackFile = temp->getWriteBackFile(); | 177 | mWriteBackFile = temp->getWriteBackFile(); |
178 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 178 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
179 | mWriteBackInFuture = 0; | 179 | mWriteBackInFuture = 0; |
180 | if ( temp->getWriteBackFuture() ) | 180 | if ( temp->getWriteBackFuture() ) |
181 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 181 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
182 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 182 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
183 | if ( action == 1000 ) { | 183 | if ( action == 1000 ) { |
184 | syncSharp(); | 184 | syncSharp(); |
185 | 185 | ||
186 | } else if ( action == 1001 ) { | 186 | } else if ( action == 1001 ) { |
187 | syncLocalFile(); | 187 | syncLocalFile(); |
188 | 188 | ||
189 | } else if ( action == 1002 ) { | 189 | } else if ( action == 1002 ) { |
190 | quickSyncLocalFile(); | 190 | quickSyncLocalFile(); |
191 | 191 | ||
192 | } else if ( action >= 1003 ) { | 192 | } else if ( action >= 1003 ) { |
193 | if ( temp->getIsLocalFileSync() ) { | 193 | if ( temp->getIsLocalFileSync() ) { |
194 | switch(mTargetApp) | 194 | switch(mTargetApp) |
195 | { | 195 | { |
196 | case (KAPI): | 196 | case (KAPI): |
197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
199 | break; | 199 | break; |
200 | case (KOPI): | 200 | case (KOPI): |
201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
202 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 202 | mLastSyncedLocalFile = temp->getRemoteFileName(); |
203 | break; | 203 | break; |
204 | case (PWMPI): | 204 | case (PWMPI): |
205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
207 | break; | 207 | break; |
208 | default: | 208 | default: |
209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
210 | break; | 210 | break; |
211 | 211 | ||
212 | } | 212 | } |
213 | } else { | 213 | } else { |
214 | if ( temp->getIsPhoneSync() ) { | 214 | if ( temp->getIsPhoneSync() ) { |
215 | mPhoneDevice = temp->getPhoneDevice( ) ; | 215 | mPhoneDevice = temp->getPhoneDevice( ) ; |
216 | mPhoneConnection = temp->getPhoneConnection( ); | 216 | mPhoneConnection = temp->getPhoneConnection( ); |
217 | mPhoneModel = temp->getPhoneModel( ); | 217 | mPhoneModel = temp->getPhoneModel( ); |
218 | syncPhone(); | 218 | syncPhone(); |
219 | } else if ( temp->getIsPiSync() ) { | 219 | } else if ( temp->getIsPiSync() ) { |
220 | mPassWordPiSync = temp->getRemotePw(); | 220 | if ( mTargetApp == KAPI ) { |
221 | mActiveSyncPort = temp->getRemotePort(); | 221 | mPassWordPiSync = temp->getRemotePwAB(); |
222 | mActiveSyncIP = temp->getRemoteIP(); | 222 | mActiveSyncPort = temp->getRemotePortAB(); |
223 | mActiveSyncIP = temp->getRemoteIPAB(); | ||
224 | } else if ( mTargetApp == KOPI ) { | ||
225 | mPassWordPiSync = temp->getRemotePw(); | ||
226 | mActiveSyncPort = temp->getRemotePort(); | ||
227 | mActiveSyncIP = temp->getRemoteIP(); | ||
228 | } else { | ||
229 | mPassWordPiSync = temp->getRemotePwPWM(); | ||
230 | mActiveSyncPort = temp->getRemotePortPWM(); | ||
231 | mActiveSyncIP = temp->getRemoteIPPWM(); | ||
232 | } | ||
223 | syncPi(); | 233 | syncPi(); |
224 | } | 234 | } |
225 | syncRemote( temp ); | 235 | syncRemote( temp ); |
226 | 236 | ||
227 | } | 237 | } |
228 | } | 238 | } |
229 | delete temp; | 239 | delete temp; |
230 | setBlockSave(false); | 240 | setBlockSave(false); |
231 | } | 241 | } |
232 | void KSyncManager::enableQuick() | 242 | void KSyncManager::enableQuick() |
233 | { | 243 | { |
234 | QDialog dia ( 0, "input-dialog", true ); | 244 | QDialog dia ( 0, "input-dialog", true ); |
235 | QLineEdit lab ( &dia ); | 245 | QLineEdit lab ( &dia ); |
236 | QVBoxLayout lay( &dia ); | 246 | QVBoxLayout lay( &dia ); |
237 | lab.setText( mPrefs->mPassiveSyncPort ); | 247 | lab.setText( mPrefs->mPassiveSyncPort ); |
238 | lay.setMargin(7); | 248 | lay.setMargin(7); |
239 | lay.setSpacing(7); | 249 | lay.setSpacing(7); |
240 | int po = 9197+mTargetApp; | 250 | int po = 9197+mTargetApp; |
241 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); | 251 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); |
242 | lay.addWidget( &label); | 252 | lay.addWidget( &label); |
243 | lay.addWidget( &lab); | 253 | lay.addWidget( &lab); |
244 | 254 | ||
245 | QLineEdit lepw ( &dia ); | 255 | QLineEdit lepw ( &dia ); |
246 | lepw.setText( mPrefs->mPassiveSyncPw ); | 256 | lepw.setText( mPrefs->mPassiveSyncPw ); |
247 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 257 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
248 | lay.addWidget( &label2); | 258 | lay.addWidget( &label2); |
249 | lay.addWidget( &lepw); | 259 | lay.addWidget( &lepw); |
250 | dia.setFixedSize( 230,80 ); | 260 | dia.setFixedSize( 230,80 ); |
251 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 261 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
252 | QPushButton pb ( "OK", &dia); | 262 | QPushButton pb ( "OK", &dia); |
253 | lay.addWidget( &pb ); | 263 | lay.addWidget( &pb ); |
254 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 264 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
255 | dia.show(); | 265 | dia.show(); |
256 | if ( ! dia.exec() ) | 266 | if ( ! dia.exec() ) |
257 | return; | 267 | return; |
258 | dia.hide(); | 268 | dia.hide(); |
259 | qApp->processEvents(); | 269 | qApp->processEvents(); |
260 | mPrefs->mPassiveSyncPw = lepw.text(); | 270 | mPrefs->mPassiveSyncPw = lepw.text(); |
261 | mPrefs->mPassiveSyncPort = lab.text(); | 271 | mPrefs->mPassiveSyncPort = lab.text(); |
262 | bool ok; | 272 | bool ok; |
263 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 273 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
264 | if ( ! ok ) { | 274 | if ( ! ok ) { |
265 | KMessageBox::information( 0, i18n("No valid port")); | 275 | KMessageBox::information( 0, i18n("No valid port")); |
266 | return; | 276 | return; |
267 | } | 277 | } |
268 | //qDebug("port %d ", port); | 278 | //qDebug("port %d ", port); |
269 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 279 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
270 | mServerSocket->setFileName( defaultFileName() ); | 280 | mServerSocket->setFileName( defaultFileName() ); |
271 | //qDebug("connected "); | 281 | //qDebug("connected "); |
272 | if ( !mServerSocket->ok() ) { | 282 | if ( !mServerSocket->ok() ) { |
273 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 283 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
274 | delete mServerSocket; | 284 | delete mServerSocket; |
275 | mServerSocket = 0; | 285 | mServerSocket = 0; |
276 | return; | 286 | return; |
277 | } | 287 | } |
278 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); | 288 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); |
279 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 289 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
280 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 290 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
281 | } | 291 | } |
282 | 292 | ||
283 | void KSyncManager::syncLocalFile() | 293 | void KSyncManager::syncLocalFile() |
284 | { | 294 | { |
285 | 295 | ||
286 | QString fn =mLastSyncedLocalFile; | 296 | QString fn =mLastSyncedLocalFile; |
287 | QString ext; | 297 | QString ext; |
288 | 298 | ||
289 | switch(mTargetApp) | 299 | switch(mTargetApp) |
290 | { | 300 | { |
291 | case (KAPI): | 301 | case (KAPI): |
292 | ext = "(*.vcf)"; | 302 | ext = "(*.vcf)"; |
293 | break; | 303 | break; |
294 | case (KOPI): | 304 | case (KOPI): |
295 | ext = "(*.ics/*.vcs)"; | 305 | ext = "(*.ics/*.vcs)"; |
296 | break; | 306 | break; |
297 | case (PWMPI): | 307 | case (PWMPI): |
298 | ext = "(*.pwm)"; | 308 | ext = "(*.pwm)"; |
299 | break; | 309 | break; |
300 | default: | 310 | default: |
301 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); | 311 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); |
302 | break; | 312 | break; |
303 | 313 | ||
304 | } | 314 | } |
305 | 315 | ||
306 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 316 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
307 | if ( fn == "" ) | 317 | if ( fn == "" ) |
308 | return; | 318 | return; |
309 | if ( syncWithFile( fn, false ) ) { | 319 | if ( syncWithFile( fn, false ) ) { |
310 | qDebug("syncLocalFile() successful "); | 320 | qDebug("syncLocalFile() successful "); |
311 | } | 321 | } |
312 | 322 | ||
313 | } | 323 | } |
314 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 324 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
315 | { | 325 | { |
316 | bool ret = false; | 326 | bool ret = false; |
317 | QFileInfo info; | 327 | QFileInfo info; |
318 | info.setFile( fn ); | 328 | info.setFile( fn ); |
319 | QString mess; | 329 | QString mess; |
320 | bool loadbup = true; | 330 | bool loadbup = true; |
321 | if ( !info. exists() ) { | 331 | if ( !info. exists() ) { |
322 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 332 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
323 | int result = QMessageBox::warning( mParent, i18n("Warning!"), | 333 | int result = QMessageBox::warning( mParent, i18n("Warning!"), |
324 | mess ); | 334 | mess ); |
325 | return ret; | 335 | return ret; |
326 | } | 336 | } |
327 | int result = 0; | 337 | int result = 0; |
328 | if ( !quick ) { | 338 | if ( !quick ) { |
329 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 339 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
330 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 340 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
331 | mess, | 341 | mess, |
332 | i18n("Sync"), i18n("Cancel"), 0, | 342 | i18n("Sync"), i18n("Cancel"), 0, |
333 | 0, 1 ); | 343 | 0, 1 ); |
334 | if ( result ) | 344 | if ( result ) |
335 | return false; | 345 | return false; |
336 | } | 346 | } |
337 | if ( mAskForPreferences ) | 347 | if ( mAskForPreferences ) |
338 | edit_sync_options(); | 348 | edit_sync_options(); |
339 | if ( result == 0 ) { | 349 | if ( result == 0 ) { |
340 | //qDebug("Now sycing ... "); | 350 | //qDebug("Now sycing ... "); |
341 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 351 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
342 | mParent->setCaption( i18n("Synchronization successful") ); | 352 | mParent->setCaption( i18n("Synchronization successful") ); |
343 | else | 353 | else |
344 | mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 354 | mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
345 | if ( ! quick ) | 355 | if ( ! quick ) |
346 | mLastSyncedLocalFile = fn; | 356 | mLastSyncedLocalFile = fn; |
347 | } | 357 | } |
348 | return ret; | 358 | return ret; |
349 | } | 359 | } |
350 | void KSyncManager::quickSyncLocalFile() | 360 | void KSyncManager::quickSyncLocalFile() |
351 | { | 361 | { |
352 | 362 | ||
353 | if ( syncWithFile( mLastSyncedLocalFile, false ) ) { | 363 | if ( syncWithFile( mLastSyncedLocalFile, false ) ) { |
354 | qDebug("quick syncLocalFile() successful "); | 364 | qDebug("quick syncLocalFile() successful "); |
355 | 365 | ||
356 | } | 366 | } |
357 | } | 367 | } |
358 | void KSyncManager::multiSync( bool askforPrefs ) | 368 | void KSyncManager::multiSync( bool askforPrefs ) |
359 | { | 369 | { |
360 | if (blockSave()) | 370 | if (blockSave()) |
361 | return; | 371 | return; |
362 | setBlockSave(true); | 372 | setBlockSave(true); |
363 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 373 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
364 | if ( QMessageBox::information( mParent, i18n("Sync"), | 374 | if ( QMessageBox::information( mParent, i18n("Sync"), |
365 | question, | 375 | question, |
366 | i18n("Yes"), i18n("No"), | 376 | i18n("Yes"), i18n("No"), |
367 | 0, 0 ) != 0 ) { | 377 | 0, 0 ) != 0 ) { |
368 | setBlockSave(false); | 378 | setBlockSave(false); |
369 | mParent->setCaption(i18n("Aborted! Nothing synced!")); | 379 | mParent->setCaption(i18n("Aborted! Nothing synced!")); |
370 | return; | 380 | return; |
371 | } | 381 | } |
372 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 382 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
373 | mSyncAlgoPrefs = mRingSyncAlgoPrefs; | 383 | mSyncAlgoPrefs = mRingSyncAlgoPrefs; |
374 | if ( askforPrefs ) { | 384 | if ( askforPrefs ) { |
375 | edit_sync_options(); | 385 | edit_sync_options(); |
376 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 386 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
377 | } | 387 | } |
378 | mParent->setCaption(i18n("Multiple sync started.") ); | 388 | mParent->setCaption(i18n("Multiple sync started.") ); |
379 | qApp->processEvents(); | 389 | qApp->processEvents(); |
380 | int num = ringSync() ; | 390 | int num = ringSync() ; |
381 | if ( num > 1 ) | 391 | if ( num > 1 ) |
382 | ringSync(); | 392 | ringSync(); |
383 | setBlockSave(false); | 393 | setBlockSave(false); |
384 | if ( num ) | 394 | if ( num ) |
385 | emit save(); | 395 | emit save(); |
386 | if ( num ) | 396 | if ( num ) |
387 | mParent->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 397 | mParent->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
388 | else | 398 | else |
389 | mParent->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 399 | mParent->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
390 | return; | 400 | return; |
391 | } | 401 | } |
392 | int KSyncManager::ringSync() | 402 | int KSyncManager::ringSync() |
393 | { | 403 | { |
394 | int syncedProfiles = 0; | 404 | int syncedProfiles = 0; |
395 | unsigned int i; | 405 | unsigned int i; |
396 | QTime timer; | 406 | QTime timer; |
397 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 407 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
398 | QStringList syncProfileNames = mSyncProfileNames; | 408 | QStringList syncProfileNames = mSyncProfileNames; |
399 | KSyncProfile* temp = new KSyncProfile (); | 409 | KSyncProfile* temp = new KSyncProfile (); |
400 | mAskForPreferences = false; | 410 | mAskForPreferences = false; |
401 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 411 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
402 | mCurrentSyncProfile = i; | 412 | mCurrentSyncProfile = i; |
403 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 413 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
404 | temp->readConfig(&config); | 414 | temp->readConfig(&config); |
405 | 415 | ||
406 | QString includeInRingSync; | 416 | QString includeInRingSync; |
407 | switch(mTargetApp) | 417 | switch(mTargetApp) |
408 | { | 418 | { |
409 | case (KAPI): | 419 | case (KAPI): |
410 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 420 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
411 | break; | 421 | break; |
412 | case (KOPI): | 422 | case (KOPI): |
413 | includeInRingSync = temp->getIncludeInRingSync(); | 423 | includeInRingSync = temp->getIncludeInRingSync(); |
414 | break; | 424 | break; |
415 | case (PWMPI): | 425 | case (PWMPI): |
416 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 426 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
417 | break; | 427 | break; |
418 | default: | 428 | default: |
419 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 429 | qDebug("KSyncManager::ringSync: invalid apptype selected"); |
420 | break; | 430 | break; |
421 | 431 | ||
422 | } | 432 | } |
423 | 433 | ||
424 | 434 | ||
425 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 435 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
426 | mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 436 | mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
427 | ++syncedProfiles; | 437 | ++syncedProfiles; |
428 | // mAskForPreferences = temp->getAskForPreferences(); | 438 | // mAskForPreferences = temp->getAskForPreferences(); |
429 | mWriteBackFile = temp->getWriteBackFile(); | 439 | mWriteBackFile = temp->getWriteBackFile(); |
430 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 440 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
431 | mWriteBackInFuture = 0; | 441 | mWriteBackInFuture = 0; |
432 | if ( temp->getWriteBackFuture() ) | 442 | if ( temp->getWriteBackFuture() ) |
433 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 443 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
434 | mShowSyncSummary = false; | 444 | mShowSyncSummary = false; |
435 | mCurrentSyncDevice = syncProfileNames[i] ; | 445 | mCurrentSyncDevice = syncProfileNames[i] ; |
436 | mCurrentSyncName = mLocalMachineName; | 446 | mCurrentSyncName = mLocalMachineName; |
437 | if ( i == 0 ) { | 447 | if ( i == 0 ) { |
438 | syncSharp(); | 448 | syncSharp(); |
439 | } else { | 449 | } else { |
440 | if ( temp->getIsLocalFileSync() ) { | 450 | if ( temp->getIsLocalFileSync() ) { |
441 | switch(mTargetApp) | 451 | switch(mTargetApp) |
442 | { | 452 | { |
443 | case (KAPI): | 453 | case (KAPI): |
444 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 454 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
445 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 455 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
446 | break; | 456 | break; |
447 | case (KOPI): | 457 | case (KOPI): |
448 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 458 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
449 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 459 | mLastSyncedLocalFile = temp->getRemoteFileName(); |
450 | break; | 460 | break; |
451 | case (PWMPI): | 461 | case (PWMPI): |
452 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 462 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
453 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 463 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
454 | break; | 464 | break; |
455 | default: | 465 | default: |
456 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 466 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
457 | break; | 467 | break; |
458 | } | 468 | } |
459 | } else { | 469 | } else { |
460 | if ( temp->getIsPhoneSync() ) { | 470 | if ( temp->getIsPhoneSync() ) { |
461 | mPhoneDevice = temp->getPhoneDevice( ) ; | 471 | mPhoneDevice = temp->getPhoneDevice( ) ; |
462 | mPhoneConnection = temp->getPhoneConnection( ); | 472 | mPhoneConnection = temp->getPhoneConnection( ); |
463 | mPhoneModel = temp->getPhoneModel( ); | 473 | mPhoneModel = temp->getPhoneModel( ); |
464 | syncPhone(); | 474 | syncPhone(); |
465 | } else | 475 | } else |
466 | syncRemote( temp, false ); | 476 | syncRemote( temp, false ); |
467 | 477 | ||
468 | } | 478 | } |
469 | } | 479 | } |
470 | timer.start(); | 480 | timer.start(); |
471 | mParent->setCaption(i18n("Multiple sync in progress ... please wait!") ); | 481 | mParent->setCaption(i18n("Multiple sync in progress ... please wait!") ); |
472 | while ( timer.elapsed () < 2000 ) { | 482 | while ( timer.elapsed () < 2000 ) { |
473 | qApp->processEvents(); | 483 | qApp->processEvents(); |
474 | #ifndef _WIN32_ | 484 | #ifndef _WIN32_ |
475 | sleep (1); | 485 | sleep (1); |
476 | #endif | 486 | #endif |
477 | } | 487 | } |
478 | 488 | ||
479 | } | 489 | } |
480 | 490 | ||
481 | } | 491 | } |
482 | delete temp; | 492 | delete temp; |
483 | return syncedProfiles; | 493 | return syncedProfiles; |
484 | } | 494 | } |
485 | 495 | ||
486 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | 496 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) |
487 | { | 497 | { |
488 | QString question; | 498 | QString question; |
489 | if ( ask ) { | 499 | if ( ask ) { |
490 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 500 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
491 | if ( QMessageBox::information( mParent, i18n("Sync"), | 501 | if ( QMessageBox::information( mParent, i18n("Sync"), |
492 | question, | 502 | question, |
493 | i18n("Yes"), i18n("No"), | 503 | i18n("Yes"), i18n("No"), |
494 | 0, 0 ) != 0 ) | 504 | 0, 0 ) != 0 ) |
495 | return; | 505 | return; |
496 | } | 506 | } |
497 | 507 | ||
498 | QString preCommand; | 508 | QString preCommand; |
499 | QString localTempFile; | 509 | QString localTempFile; |
500 | QString postCommand; | 510 | QString postCommand; |
501 | 511 | ||
502 | switch(mTargetApp) | 512 | switch(mTargetApp) |
503 | { | 513 | { |
504 | case (KAPI): | 514 | case (KAPI): |
505 | preCommand = prof->getPreSyncCommandAB(); | 515 | preCommand = prof->getPreSyncCommandAB(); |
506 | postCommand = prof->getPostSyncCommandAB(); | 516 | postCommand = prof->getPostSyncCommandAB(); |
507 | localTempFile = prof->getLocalTempFileAB(); | 517 | localTempFile = prof->getLocalTempFileAB(); |
508 | break; | 518 | break; |
509 | case (KOPI): | 519 | case (KOPI): |
510 | preCommand = prof->getPreSyncCommand(); | 520 | preCommand = prof->getPreSyncCommand(); |
511 | postCommand = prof->getPostSyncCommand(); | 521 | postCommand = prof->getPostSyncCommand(); |
512 | localTempFile = prof->getLocalTempFile(); | 522 | localTempFile = prof->getLocalTempFile(); |
513 | break; | 523 | break; |
514 | case (PWMPI): | 524 | case (PWMPI): |
515 | preCommand = prof->getPreSyncCommandPWM(); | 525 | preCommand = prof->getPreSyncCommandPWM(); |
516 | postCommand = prof->getPostSyncCommandPWM(); | 526 | postCommand = prof->getPostSyncCommandPWM(); |
517 | localTempFile = prof->getLocalTempFilePWM(); | 527 | localTempFile = prof->getLocalTempFilePWM(); |
518 | break; | 528 | break; |
519 | default: | 529 | default: |
520 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); | 530 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); |
521 | break; | 531 | break; |
522 | } | 532 | } |
523 | 533 | ||
524 | 534 | ||
525 | int fi; | 535 | int fi; |
526 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 536 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
527 | QString pwd = getPassword(); | 537 | QString pwd = getPassword(); |
528 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 538 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
529 | 539 | ||
530 | } | 540 | } |
531 | int maxlen = 30; | 541 | int maxlen = 30; |
532 | if ( QApplication::desktop()->width() > 320 ) | 542 | if ( QApplication::desktop()->width() > 320 ) |
533 | maxlen += 25; | 543 | maxlen += 25; |
534 | mParent->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 544 | mParent->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
535 | int fileSize = 0; | 545 | int fileSize = 0; |
536 | int result = system ( preCommand ); | 546 | int result = system ( preCommand ); |
537 | // 0 : okay | 547 | // 0 : okay |
538 | // 256: no such file or dir | 548 | // 256: no such file or dir |
539 | // | 549 | // |
540 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 550 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
541 | if ( result != 0 ) { | 551 | if ( result != 0 ) { |
542 | unsigned int len = maxlen; | 552 | unsigned int len = maxlen; |
543 | while ( len < preCommand.length() ) { | 553 | while ( len < preCommand.length() ) { |
544 | preCommand.insert( len , "\n" ); | 554 | preCommand.insert( len , "\n" ); |
545 | len += maxlen +2; | 555 | len += maxlen +2; |
546 | } | 556 | } |
547 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; | 557 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; |
548 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 558 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
549 | question, | 559 | question, |
550 | i18n("Okay!")) ; | 560 | i18n("Okay!")) ; |
551 | mParent->setCaption (""); | 561 | mParent->setCaption (""); |
552 | return; | 562 | return; |
553 | } | 563 | } |
554 | mParent->setCaption ( i18n( "Copying succeed." ) ); | 564 | mParent->setCaption ( i18n( "Copying succeed." ) ); |
555 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 565 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
556 | 566 | ||
557 | 567 | ||
558 | 568 | ||
559 | if ( syncWithFile( localTempFile, true ) ) { | 569 | if ( syncWithFile( localTempFile, true ) ) { |
560 | // Event* e = mView->getLastSyncEvent(); | 570 | // Event* e = mView->getLastSyncEvent(); |
561 | // e->setReadOnly( false ); | 571 | // e->setReadOnly( false ); |
562 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 572 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
563 | // e->setReadOnly( true ); | 573 | // e->setReadOnly( true ); |
564 | if ( mWriteBackFile ) { | 574 | if ( mWriteBackFile ) { |
565 | int fi; | 575 | int fi; |
566 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 576 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
567 | QString pwd = getPassword(); | 577 | QString pwd = getPassword(); |
568 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 578 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
569 | 579 | ||
570 | } | 580 | } |
571 | mParent->setCaption ( i18n( "Writing back file ..." ) ); | 581 | mParent->setCaption ( i18n( "Writing back file ..." ) ); |
572 | result = system ( postCommand ); | 582 | result = system ( postCommand ); |
573 | qDebug("Writing back file result: %d ", result); | 583 | qDebug("Writing back file result: %d ", result); |
574 | if ( result != 0 ) { | 584 | if ( result != 0 ) { |
575 | mParent->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 585 | mParent->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
576 | return; | 586 | return; |
577 | } else { | 587 | } else { |
578 | mParent->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 588 | mParent->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
579 | } | 589 | } |
580 | } | 590 | } |
581 | } | 591 | } |
582 | return; | 592 | return; |
583 | } | 593 | } |
584 | 594 | ||
585 | void KSyncManager::edit_sync_options() | 595 | void KSyncManager::edit_sync_options() |
586 | { | 596 | { |
587 | //mDialogManager->showSyncOptions(); | 597 | //mDialogManager->showSyncOptions(); |
588 | //mSyncAlgoPrefs | 598 | //mSyncAlgoPrefs |
589 | QDialog dia( mParent, "dia", true ); | 599 | QDialog dia( mParent, "dia", true ); |
590 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 600 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
591 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 601 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
592 | QVBoxLayout lay ( &dia ); | 602 | QVBoxLayout lay ( &dia ); |
593 | lay.setSpacing( 2 ); | 603 | lay.setSpacing( 2 ); |
594 | lay.setMargin( 3 ); | 604 | lay.setMargin( 3 ); |
595 | lay.addWidget(&gr); | 605 | lay.addWidget(&gr); |
596 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 606 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
597 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 607 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
598 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 608 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
599 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 609 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
600 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 610 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
601 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 611 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
602 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 612 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
603 | QPushButton pb ( "OK", &dia); | 613 | QPushButton pb ( "OK", &dia); |
604 | lay.addWidget( &pb ); | 614 | lay.addWidget( &pb ); |
605 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 615 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
606 | switch ( mSyncAlgoPrefs ) { | 616 | switch ( mSyncAlgoPrefs ) { |
607 | case 0: | 617 | case 0: |
608 | loc.setChecked( true); | 618 | loc.setChecked( true); |
609 | break; | 619 | break; |
610 | case 1: | 620 | case 1: |
611 | rem.setChecked( true ); | 621 | rem.setChecked( true ); |
612 | break; | 622 | break; |
613 | case 2: | 623 | case 2: |
614 | newest.setChecked( true); | 624 | newest.setChecked( true); |
615 | break; | 625 | break; |
616 | case 3: | 626 | case 3: |
617 | ask.setChecked( true); | 627 | ask.setChecked( true); |
618 | break; | 628 | break; |
619 | case 4: | 629 | case 4: |
620 | f_loc.setChecked( true); | 630 | f_loc.setChecked( true); |
621 | break; | 631 | break; |
622 | case 5: | 632 | case 5: |
623 | f_rem.setChecked( true); | 633 | f_rem.setChecked( true); |
624 | break; | 634 | break; |
625 | case 6: | 635 | case 6: |
626 | // both.setChecked( true); | 636 | // both.setChecked( true); |
627 | break; | 637 | break; |
628 | default: | 638 | default: |
629 | break; | 639 | break; |
630 | } | 640 | } |
631 | if ( dia.exec() ) { | 641 | if ( dia.exec() ) { |
632 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 642 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
633 | } | 643 | } |
634 | 644 | ||
635 | 645 | ||
636 | } | 646 | } |
637 | QString KSyncManager::getPassword( ) | 647 | QString KSyncManager::getPassword( ) |
638 | { | 648 | { |
639 | QString retfile = ""; | 649 | QString retfile = ""; |
640 | QDialog dia ( mParent, "input-dialog", true ); | 650 | QDialog dia ( mParent, "input-dialog", true ); |
641 | QLineEdit lab ( &dia ); | 651 | QLineEdit lab ( &dia ); |
642 | lab.setEchoMode( QLineEdit::Password ); | 652 | lab.setEchoMode( QLineEdit::Password ); |
643 | QVBoxLayout lay( &dia ); | 653 | QVBoxLayout lay( &dia ); |
644 | lay.setMargin(7); | 654 | lay.setMargin(7); |
645 | lay.setSpacing(7); | 655 | lay.setSpacing(7); |
646 | lay.addWidget( &lab); | 656 | lay.addWidget( &lab); |
647 | dia.setFixedSize( 230,50 ); | 657 | dia.setFixedSize( 230,50 ); |
648 | dia.setCaption( i18n("Enter password") ); | 658 | dia.setCaption( i18n("Enter password") ); |
649 | QPushButton pb ( "OK", &dia); | 659 | QPushButton pb ( "OK", &dia); |
650 | lay.addWidget( &pb ); | 660 | lay.addWidget( &pb ); |
651 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 661 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
652 | dia.show(); | 662 | dia.show(); |
653 | int res = dia.exec(); | 663 | int res = dia.exec(); |
654 | if ( res ) | 664 | if ( res ) |
655 | retfile = lab.text(); | 665 | retfile = lab.text(); |
656 | dia.hide(); | 666 | dia.hide(); |
657 | qApp->processEvents(); | 667 | qApp->processEvents(); |
658 | return retfile; | 668 | return retfile; |
659 | 669 | ||
660 | } | 670 | } |
661 | 671 | ||
662 | 672 | ||
663 | void KSyncManager::confSync() | 673 | void KSyncManager::confSync() |
664 | { | 674 | { |
665 | static KSyncPrefsDialog* sp = 0; | 675 | static KSyncPrefsDialog* sp = 0; |
666 | if ( ! sp ) { | 676 | if ( ! sp ) { |
667 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 677 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
668 | } | 678 | } |
669 | sp->usrReadConfig(); | 679 | sp->usrReadConfig(); |
670 | #ifndef DESKTOP_VERSION | 680 | #ifndef DESKTOP_VERSION |
671 | sp->showMaximized(); | 681 | sp->showMaximized(); |
672 | #else | 682 | #else |
673 | sp->show(); | 683 | sp->show(); |
674 | #endif | 684 | #endif |
675 | sp->exec(); | 685 | sp->exec(); |
676 | mSyncProfileNames = sp->getSyncProfileNames(); | 686 | mSyncProfileNames = sp->getSyncProfileNames(); |
677 | mLocalMachineName = sp->getLocalMachineName (); | 687 | mLocalMachineName = sp->getLocalMachineName (); |
678 | fillSyncMenu(); | 688 | fillSyncMenu(); |
679 | } | 689 | } |
680 | 690 | ||
681 | void KSyncManager::syncSharp() | 691 | void KSyncManager::syncSharp() |
682 | { | 692 | { |
683 | if ( ! syncExternalApplication("sharp") ) | 693 | if ( ! syncExternalApplication("sharp") ) |
684 | qDebug("ERROR sync sharp ");; | 694 | qDebug("ERROR sync sharp ");; |
685 | } | 695 | } |
686 | 696 | ||
687 | bool KSyncManager::syncExternalApplication(QString resource) | 697 | bool KSyncManager::syncExternalApplication(QString resource) |
688 | { | 698 | { |
689 | 699 | ||
690 | emit save(); | 700 | emit save(); |
691 | 701 | ||
692 | if ( mAskForPreferences ) | 702 | if ( mAskForPreferences ) |
693 | edit_sync_options(); | 703 | edit_sync_options(); |
694 | 704 | ||
695 | qDebug("sync %s", resource.latin1()); | 705 | qDebug("sync %s", resource.latin1()); |
696 | 706 | ||
697 | bool syncOK = mImplementation->syncExternal(this, resource); | 707 | bool syncOK = mImplementation->syncExternal(this, resource); |
698 | 708 | ||
699 | return syncOK; | 709 | return syncOK; |
700 | 710 | ||
701 | } | 711 | } |
702 | 712 | ||
703 | void KSyncManager::syncPhone() | 713 | void KSyncManager::syncPhone() |
704 | { | 714 | { |
705 | emit save(); | 715 | emit save(); |
706 | 716 | ||
707 | qDebug("pending syncPhone(); "); | 717 | qDebug("pending syncPhone(); "); |
708 | //mView->syncPhone(); | 718 | //mView->syncPhone(); |
709 | 719 | ||
710 | } | 720 | } |
711 | 721 | ||
712 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 722 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
713 | { | 723 | { |
714 | if (!bar->isVisible()) | 724 | if (!bar->isVisible()) |
715 | { | 725 | { |
716 | bar->setCaption (caption); | 726 | bar->setCaption (caption); |
717 | bar->setTotalSteps ( total ) ; | 727 | bar->setTotalSteps ( total ) ; |
718 | 728 | ||
719 | bar->show(); | 729 | bar->show(); |
720 | } | 730 | } |
721 | 731 | ||
722 | bar->setProgress( percentage ); | 732 | bar->setProgress( percentage ); |
723 | } | 733 | } |
724 | 734 | ||
725 | void KSyncManager::hideProgressBar() | 735 | void KSyncManager::hideProgressBar() |
726 | { | 736 | { |
727 | bar->hide(); | 737 | bar->hide(); |
728 | } | 738 | } |
729 | 739 | ||
730 | bool KSyncManager::isProgressBarCanceled() | 740 | bool KSyncManager::isProgressBarCanceled() |
731 | { | 741 | { |
732 | return !bar->isVisible(); | 742 | return !bar->isVisible(); |
733 | } | 743 | } |
734 | 744 | ||
735 | QString KSyncManager::syncFileName() | 745 | QString KSyncManager::syncFileName() |
736 | { | 746 | { |
737 | 747 | ||
738 | QString fn = "tempfile"; | 748 | QString fn = "tempfile"; |
739 | switch(mTargetApp) | 749 | switch(mTargetApp) |
740 | { | 750 | { |
741 | case (KAPI): | 751 | case (KAPI): |
742 | fn = "addressbook.vcf"; | 752 | fn = "addressbook.vcf"; |
743 | break; | 753 | break; |
744 | case (KOPI): | 754 | case (KOPI): |
745 | fn = "synccalendar.ics"; | 755 | fn = "synccalendar.ics"; |
746 | break; | 756 | break; |
747 | case (PWMPI): | 757 | case (PWMPI): |
748 | fn = "manager.pwm"; | 758 | fn = "manager.pwm"; |
749 | break; | 759 | break; |
750 | default: | 760 | default: |
751 | break; | 761 | break; |
752 | } | 762 | } |
753 | #ifdef _WIN32_ | 763 | #ifdef _WIN32_ |
754 | return locateLocal( "tmp", fn ); | 764 | return locateLocal( "tmp", fn ); |
755 | #else | 765 | #else |
756 | return (QString( "/tmp/" )+ fn ); | 766 | return (QString( "/tmp/" )+ fn ); |
757 | #endif | 767 | #endif |
758 | } | 768 | } |
759 | 769 | ||
760 | void KSyncManager::syncPi() | 770 | void KSyncManager::syncPi() |
761 | { | 771 | { |
762 | qApp->processEvents(); | 772 | qApp->processEvents(); |
763 | bool ok; | 773 | bool ok; |
764 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 774 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
765 | if ( ! ok ) { | 775 | if ( ! ok ) { |
766 | mParent->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 776 | mParent->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
767 | return; | 777 | return; |
768 | } | 778 | } |
769 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 779 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); |
770 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 780 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
771 | mParent->setCaption( i18n("Sending request for remote file ...") ); | 781 | mParent->setCaption( i18n("Sending request for remote file ...") ); |
772 | commandSocket->readFile( syncFileName() ); | 782 | commandSocket->readFile( syncFileName() ); |
773 | } | 783 | } |
774 | 784 | ||
775 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 785 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
776 | { | 786 | { |
777 | qDebug("MainWindow::deleteCommandSocket %d", state); | 787 | qDebug("MainWindow::deleteCommandSocket %d", state); |
778 | 788 | ||
779 | //enum { success, errorW, errorR, quiet }; | 789 | //enum { success, errorW, errorR, quiet }; |
780 | if ( state == KCommandSocket::errorR ) { | 790 | if ( state == KCommandSocket::errorR ) { |
781 | mParent->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 791 | mParent->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
782 | delete s; | 792 | delete s; |
783 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 793 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
784 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 794 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
785 | commandSocket->sendStop(); | 795 | commandSocket->sendStop(); |
786 | return; | 796 | return; |
787 | 797 | ||
788 | } else if ( state == KCommandSocket::errorW ) { | 798 | } else if ( state == KCommandSocket::errorW ) { |
789 | mParent->setCaption( i18n("ERROR:Writing back file failed.") ); | 799 | mParent->setCaption( i18n("ERROR:Writing back file failed.") ); |
790 | 800 | ||
791 | } else if ( state == KCommandSocket::successR ) { | 801 | } else if ( state == KCommandSocket::successR ) { |
792 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 802 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
793 | 803 | ||
794 | } else if ( state == KCommandSocket::successW ) { | 804 | } else if ( state == KCommandSocket::successW ) { |
795 | mParent->setCaption( i18n("Pi-Sync succesful!") ); | 805 | mParent->setCaption( i18n("Pi-Sync succesful!") ); |
796 | } | 806 | } |
797 | 807 | ||
798 | delete s; | 808 | delete s; |
799 | } | 809 | } |
800 | 810 | ||
801 | void KSyncManager::readFileFromSocket() | 811 | void KSyncManager::readFileFromSocket() |
802 | { | 812 | { |
803 | QString fileName = syncFileName(); | 813 | QString fileName = syncFileName(); |
804 | mParent->setCaption( i18n("Remote file saved to temp file.") ); | 814 | mParent->setCaption( i18n("Remote file saved to temp file.") ); |
805 | if ( ! syncWithFile( fileName , true ) ) { | 815 | if ( ! syncWithFile( fileName , true ) ) { |
806 | mParent->setCaption( i18n("Syncing failed.") ); | 816 | mParent->setCaption( i18n("Syncing failed.") ); |
807 | qDebug("Syncing failed "); | 817 | qDebug("Syncing failed "); |
808 | return; | 818 | return; |
809 | } | 819 | } |
810 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 820 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
811 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 821 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
812 | if ( mWriteBackFile ) | 822 | if ( mWriteBackFile ) |
813 | commandSocket->writeFile( fileName ); | 823 | commandSocket->writeFile( fileName ); |
814 | else { | 824 | else { |
815 | commandSocket->sendStop(); | 825 | commandSocket->sendStop(); |
816 | mParent->setCaption( i18n("Pi-Sync succesful!") ); | 826 | mParent->setCaption( i18n("Pi-Sync succesful!") ); |
817 | } | 827 | } |
818 | } | 828 | } |
819 | 829 | ||
820 | 830 | ||
821 | 831 | ||
822 | 832 | ||
823 | 833 | ||
824 | 834 | ||
825 | 835 | ||
826 | 836 | ||
827 | 837 | ||
828 | 838 | ||
829 | 839 | ||
830 | 840 | ||
831 | 841 | ||
832 | 842 | ||
833 | 843 | ||
834 | 844 | ||
835 | 845 | ||
836 | 846 | ||
837 | 847 | ||
838 | 848 | ||
839 | 849 | ||
840 | 850 | ||
841 | 851 | ||
842 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 852 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
843 | { | 853 | { |
844 | mPassWord = pw; | 854 | mPassWord = pw; |
845 | mSocket = 0; | 855 | mSocket = 0; |
846 | mSyncActionDialog = 0; | 856 | mSyncActionDialog = 0; |
847 | blockRC = false; | 857 | blockRC = false; |
848 | }; | 858 | }; |
849 | 859 | ||
850 | void KServerSocket::newConnection ( int socket ) | 860 | void KServerSocket::newConnection ( int socket ) |
851 | { | 861 | { |
852 | // qDebug("KServerSocket:New connection %d ", socket); | 862 | // qDebug("KServerSocket:New connection %d ", socket); |
853 | if ( mSocket ) { | 863 | if ( mSocket ) { |
854 | qDebug("KServerSocket::newConnection Socket deleted! "); | 864 | qDebug("KServerSocket::newConnection Socket deleted! "); |
855 | delete mSocket; | 865 | delete mSocket; |
856 | mSocket = 0; | 866 | mSocket = 0; |
857 | } | 867 | } |
858 | mSocket = new QSocket( this ); | 868 | mSocket = new QSocket( this ); |
859 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 869 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
860 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 870 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
861 | mSocket->setSocket( socket ); | 871 | mSocket->setSocket( socket ); |
862 | } | 872 | } |
863 | 873 | ||
864 | void KServerSocket::discardClient() | 874 | void KServerSocket::discardClient() |
865 | { | 875 | { |
866 | //qDebug(" KServerSocket::discardClient()"); | 876 | //qDebug(" KServerSocket::discardClient()"); |
867 | if ( mSocket ) { | 877 | if ( mSocket ) { |
868 | delete mSocket; | 878 | delete mSocket; |
869 | mSocket = 0; | 879 | mSocket = 0; |
870 | } | 880 | } |
871 | //emit endConnect(); | 881 | //emit endConnect(); |
872 | } | 882 | } |
873 | void KServerSocket::readClient() | 883 | void KServerSocket::readClient() |
874 | { | 884 | { |
875 | if ( blockRC ) | 885 | if ( blockRC ) |
876 | return; | 886 | return; |
877 | if ( mSocket == 0 ) { | 887 | if ( mSocket == 0 ) { |
878 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 888 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); |
879 | return; | 889 | return; |
880 | } | 890 | } |
881 | qDebug("KServerSocket readClient()"); | 891 | qDebug("KServerSocket readClient()"); |
882 | if ( mSocket->canReadLine() ) { | 892 | if ( mSocket->canReadLine() ) { |
883 | QString line = mSocket->readLine(); | 893 | QString line = mSocket->readLine(); |
884 | qDebug("KServerSocket readline: %s ", line.latin1()); | 894 | qDebug("KServerSocket readline: %s ", line.latin1()); |
885 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 895 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
886 | if ( tokens[0] == "GET" ) { | 896 | if ( tokens[0] == "GET" ) { |
887 | if ( tokens[1] == mPassWord ) | 897 | if ( tokens[1] == mPassWord ) |
888 | //emit sendFile( mSocket ); | 898 | //emit sendFile( mSocket ); |
889 | send_file(); | 899 | send_file(); |
890 | else { | 900 | else { |
891 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); | 901 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); |
892 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 902 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
893 | } | 903 | } |
894 | } | 904 | } |
895 | if ( tokens[0] == "PUT" ) { | 905 | if ( tokens[0] == "PUT" ) { |
896 | if ( tokens[1] == mPassWord ) { | 906 | if ( tokens[1] == mPassWord ) { |
897 | //emit getFile( mSocket ); | 907 | //emit getFile( mSocket ); |
898 | blockRC = true; | 908 | blockRC = true; |
899 | get_file(); | 909 | get_file(); |
900 | } | 910 | } |
901 | else { | 911 | else { |
902 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); | 912 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); |
903 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 913 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
904 | } | 914 | } |
905 | } | 915 | } |
906 | if ( tokens[0] == "STOP" ) { | 916 | if ( tokens[0] == "STOP" ) { |
907 | //emit endConnect(); | 917 | //emit endConnect(); |
908 | end_connect(); | 918 | end_connect(); |
909 | } | 919 | } |
910 | } | 920 | } |
911 | } | 921 | } |
912 | void KServerSocket::end_connect() | 922 | void KServerSocket::end_connect() |
913 | { | 923 | { |
914 | delete mSyncActionDialog; | 924 | delete mSyncActionDialog; |
915 | mSyncActionDialog = 0; | 925 | mSyncActionDialog = 0; |
916 | } | 926 | } |
917 | void KServerSocket::send_file() | 927 | void KServerSocket::send_file() |
918 | { | 928 | { |
919 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 929 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
920 | if ( mSyncActionDialog ) | 930 | if ( mSyncActionDialog ) |
921 | delete mSyncActionDialog; | 931 | delete mSyncActionDialog; |
922 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 932 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
923 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 933 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
924 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 934 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
925 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 935 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
926 | lay->addWidget( label); | 936 | lay->addWidget( label); |
927 | lay->setMargin(7); | 937 | lay->setMargin(7); |
928 | lay->setSpacing(7); | 938 | lay->setSpacing(7); |
929 | mSyncActionDialog->setFixedSize( 230, 120); | 939 | mSyncActionDialog->setFixedSize( 230, 120); |
930 | mSyncActionDialog->show(); | 940 | mSyncActionDialog->show(); |
931 | qDebug("KSS::saving ... "); | 941 | qDebug("KSS::saving ... "); |
932 | emit request_file(); | 942 | emit request_file(); |
933 | qApp->processEvents(); | 943 | qApp->processEvents(); |
934 | QString fileName = mFileName; | 944 | QString fileName = mFileName; |
935 | QFile file( fileName ); | 945 | QFile file( fileName ); |
936 | if (!file.open( IO_ReadOnly ) ) { | 946 | if (!file.open( IO_ReadOnly ) ) { |
937 | delete mSyncActionDialog; | 947 | delete mSyncActionDialog; |
938 | mSyncActionDialog = 0; | 948 | mSyncActionDialog = 0; |
939 | qDebug("KSS::error open file "); | 949 | qDebug("KSS::error open file "); |
940 | mSocket->close(); | 950 | mSocket->close(); |
941 | if ( mSocket->state() == QSocket::Idle ) | 951 | if ( mSocket->state() == QSocket::Idle ) |
942 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 952 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
943 | return ; | 953 | return ; |
944 | 954 | ||
945 | } | 955 | } |
946 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 956 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
947 | QTextStream ts( &file ); | 957 | QTextStream ts( &file ); |
948 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 958 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
949 | QTextStream os( mSocket ); | 959 | QTextStream os( mSocket ); |
950 | os.setCodec( QTextCodec::codecForName("utf8") ); | 960 | os.setCodec( QTextCodec::codecForName("utf8") ); |
951 | //os.setEncoding( QTextStream::UnicodeUTF8 ); | 961 | //os.setEncoding( QTextStream::UnicodeUTF8 ); |
952 | while ( ! ts.atEnd() ) { | 962 | while ( ! ts.atEnd() ) { |
953 | os << ts.readLine() << "\n"; | 963 | os << ts.readLine() << "\n"; |
954 | } | 964 | } |
955 | //os << ts.read(); | 965 | //os << ts.read(); |
956 | file.close(); | 966 | file.close(); |
957 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 967 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
958 | mSocket->close(); | 968 | mSocket->close(); |
959 | if ( mSocket->state() == QSocket::Idle ) | 969 | if ( mSocket->state() == QSocket::Idle ) |
960 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 970 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
961 | } | 971 | } |
962 | void KServerSocket::get_file() | 972 | void KServerSocket::get_file() |
963 | { | 973 | { |
964 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 974 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
965 | 975 | ||
966 | piTime.start(); | 976 | piTime.start(); |
967 | piFileString = ""; | 977 | piFileString = ""; |
968 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 978 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
969 | } | 979 | } |
970 | 980 | ||
971 | 981 | ||
972 | void KServerSocket::readBackFileFromSocket() | 982 | void KServerSocket::readBackFileFromSocket() |
973 | { | 983 | { |
974 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 984 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
975 | while ( mSocket->canReadLine () ) { | 985 | while ( mSocket->canReadLine () ) { |
976 | piTime.restart(); | 986 | piTime.restart(); |
977 | QString line = mSocket->readLine (); | 987 | QString line = mSocket->readLine (); |
978 | piFileString += line; | 988 | piFileString += line; |
979 | //qDebug("readline: %s ", line.latin1()); | 989 | //qDebug("readline: %s ", line.latin1()); |
980 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 990 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
981 | 991 | ||
982 | } | 992 | } |
983 | if ( piTime.elapsed () < 3000 ) { | 993 | if ( piTime.elapsed () < 3000 ) { |
984 | // wait for more | 994 | // wait for more |
985 | //qDebug("waitformore "); | 995 | //qDebug("waitformore "); |
986 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 996 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
987 | return; | 997 | return; |
988 | } | 998 | } |
989 | QString fileName = mFileName; | 999 | QString fileName = mFileName; |
990 | QFile file ( fileName ); | 1000 | QFile file ( fileName ); |