author | zautrix <zautrix> | 2004-08-01 12:56:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 12:56:11 (UTC) |
commit | cc2643f4be54269db8c24f66fdcbbf6954d5f537 (patch) (unidiff) | |
tree | 3562598dac624305dfb9fd1911a4b314ae40945d | |
parent | c31e99f265dbe8762efca20667f8ccd973840f8f (diff) | |
download | kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.zip kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.tar.gz kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.tar.bz2 |
Made sync profile dialog korganizer independent
-rw-r--r-- | korganizer/calendarview.cpp | 28 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.cpp | 44 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.h | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 21 |
5 files changed, 47 insertions, 52 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b543eca..c75d10e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -47,385 +47,384 @@ | |||
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 "kosyncprefsdialog.h" | 61 | #include "kosyncprefsdialog.h" |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | 66 | ||
67 | #include <libkcal/vcaldrag.h> | 67 | #include <libkcal/vcaldrag.h> |
68 | #include <libkcal/icaldrag.h> | 68 | #include <libkcal/icaldrag.h> |
69 | #include <libkcal/icalformat.h> | 69 | #include <libkcal/icalformat.h> |
70 | #include <libkcal/vcalformat.h> | 70 | #include <libkcal/vcalformat.h> |
71 | #include <libkcal/scheduler.h> | 71 | #include <libkcal/scheduler.h> |
72 | #include <libkcal/calendarlocal.h> | 72 | #include <libkcal/calendarlocal.h> |
73 | #include <libkcal/journal.h> | 73 | #include <libkcal/journal.h> |
74 | #include <libkcal/calfilter.h> | 74 | #include <libkcal/calfilter.h> |
75 | #include <libkcal/attendee.h> | 75 | #include <libkcal/attendee.h> |
76 | #include <libkcal/dndfactory.h> | 76 | #include <libkcal/dndfactory.h> |
77 | #include <libkcal/freebusy.h> | 77 | #include <libkcal/freebusy.h> |
78 | #include <libkcal/filestorage.h> | 78 | #include <libkcal/filestorage.h> |
79 | #include <libkcal/calendarresources.h> | 79 | #include <libkcal/calendarresources.h> |
80 | #include <libkcal/qtopiaformat.h> | 80 | #include <libkcal/qtopiaformat.h> |
81 | #include "../kalarmd/alarmdialog.h" | 81 | #include "../kalarmd/alarmdialog.h" |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | #include <libkcal/sharpformat.h> | 84 | #include <libkcal/sharpformat.h> |
85 | #endif | 85 | #endif |
86 | #ifndef KORG_NOMAIL | 86 | #ifndef KORG_NOMAIL |
87 | #include "komailclient.h" | 87 | #include "komailclient.h" |
88 | #endif | 88 | #endif |
89 | #ifndef KORG_NOPRINTER | 89 | #ifndef KORG_NOPRINTER |
90 | #include "calprinter.h" | 90 | #include "calprinter.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPLUGINS | 92 | #ifndef KORG_NOPLUGINS |
93 | #include "kocore.h" | 93 | #include "kocore.h" |
94 | #endif | 94 | #endif |
95 | #include "koeventeditor.h" | 95 | #include "koeventeditor.h" |
96 | #include "kotodoeditor.h" | 96 | #include "kotodoeditor.h" |
97 | #include "koprefs.h" | 97 | #include "koprefs.h" |
98 | #include "koeventviewerdialog.h" | 98 | #include "koeventviewerdialog.h" |
99 | #include "publishdialog.h" | 99 | #include "publishdialog.h" |
100 | #include "kofilterview.h" | 100 | #include "kofilterview.h" |
101 | #include "koglobals.h" | 101 | #include "koglobals.h" |
102 | #include "koviewmanager.h" | 102 | #include "koviewmanager.h" |
103 | #include "koagendaview.h" | 103 | #include "koagendaview.h" |
104 | #include "kodialogmanager.h" | 104 | #include "kodialogmanager.h" |
105 | #include "outgoingdialog.h" | 105 | #include "outgoingdialog.h" |
106 | #include "incomingdialog.h" | 106 | #include "incomingdialog.h" |
107 | #include "statusdialog.h" | 107 | #include "statusdialog.h" |
108 | #include "kdatenavigator.h" | 108 | #include "kdatenavigator.h" |
109 | #include "kotodoview.h" | 109 | #include "kotodoview.h" |
110 | #include "datenavigator.h" | 110 | #include "datenavigator.h" |
111 | #include "resourceview.h" | 111 | #include "resourceview.h" |
112 | #include "navigatorbar.h" | 112 | #include "navigatorbar.h" |
113 | #include "searchdialog.h" | 113 | #include "searchdialog.h" |
114 | #include "mainwindow.h" | 114 | #include "mainwindow.h" |
115 | 115 | ||
116 | #include "calendarview.h" | 116 | #include "calendarview.h" |
117 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
118 | #include <qtopia/alarmserver.h> | 118 | #include <qtopia/alarmserver.h> |
119 | #endif | 119 | #endif |
120 | #ifndef _WIN32_ | 120 | #ifndef _WIN32_ |
121 | #include <stdlib.h> | 121 | #include <stdlib.h> |
122 | #include <stdio.h> | 122 | #include <stdio.h> |
123 | #include <unistd.h> | 123 | #include <unistd.h> |
124 | #else | 124 | #else |
125 | #include <qprocess.h> | 125 | #include <qprocess.h> |
126 | #endif | 126 | #endif |
127 | using namespace KOrg; | 127 | using namespace KOrg; |
128 | using namespace KCal; | 128 | using namespace KCal; |
129 | extern int globalFlagBlockAgenda; | 129 | extern int globalFlagBlockAgenda; |
130 | extern int globalFlagBlockStartup; | 130 | extern int globalFlagBlockStartup; |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | class KOBeamPrefs : public QDialog | 134 | class KOBeamPrefs : public QDialog |
135 | { | 135 | { |
136 | public: | 136 | public: |
137 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 137 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
138 | QDialog( parent, name, true ) | 138 | QDialog( parent, name, true ) |
139 | { | 139 | { |
140 | setCaption( i18n("Beam Options") ); | 140 | setCaption( i18n("Beam Options") ); |
141 | QVBoxLayout* lay = new QVBoxLayout( this ); | 141 | QVBoxLayout* lay = new QVBoxLayout( this ); |
142 | lay->setSpacing( 3 ); | 142 | lay->setSpacing( 3 ); |
143 | lay->setMargin( 3 ); | 143 | lay->setMargin( 3 ); |
144 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 144 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
145 | lay->addWidget( format ); | 145 | lay->addWidget( format ); |
146 | format->setExclusive ( true ) ; | 146 | format->setExclusive ( true ) ; |
147 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 147 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
148 | lay->addWidget( time ); time->setExclusive ( true ) ; | 148 | lay->addWidget( time ); time->setExclusive ( true ) ; |
149 | vcal = new QRadioButton(" vCalendar ", format ); | 149 | vcal = new QRadioButton(" vCalendar ", format ); |
150 | ical = new QRadioButton(" iCalendar ", format ); | 150 | ical = new QRadioButton(" iCalendar ", format ); |
151 | vcal->setChecked( true ); | 151 | vcal->setChecked( true ); |
152 | tz = new QRadioButton(i18n(" With timezone "), time ); | 152 | tz = new QRadioButton(i18n(" With timezone "), time ); |
153 | local = new QRadioButton(i18n(" Local time "), time ); | 153 | local = new QRadioButton(i18n(" Local time "), time ); |
154 | tz->setChecked( true ); | 154 | tz->setChecked( true ); |
155 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 155 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
156 | lay->addWidget( ok ); | 156 | lay->addWidget( ok ); |
157 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 157 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
158 | lay->addWidget( cancel ); | 158 | lay->addWidget( cancel ); |
159 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 159 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
160 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 160 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
161 | resize( 200, 200 ); | 161 | resize( 200, 200 ); |
162 | } | 162 | } |
163 | 163 | ||
164 | bool beamVcal() { return vcal->isChecked(); } | 164 | bool beamVcal() { return vcal->isChecked(); } |
165 | bool beamLocal() { return local->isChecked(); } | 165 | bool beamLocal() { return local->isChecked(); } |
166 | private: | 166 | private: |
167 | QRadioButton* vcal, *ical, *local, *tz; | 167 | QRadioButton* vcal, *ical, *local, *tz; |
168 | }; | 168 | }; |
169 | class KOCatPrefs : public QDialog | 169 | class KOCatPrefs : public QDialog |
170 | { | 170 | { |
171 | public: | 171 | public: |
172 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 185 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | 201 | ||
202 | 202 | ||
203 | CalendarView::CalendarView( CalendarResources *calendar, | 203 | CalendarView::CalendarView( CalendarResources *calendar, |
204 | QWidget *parent, const char *name ) | 204 | QWidget *parent, const char *name ) |
205 | : CalendarViewBase( parent, name ), | 205 | : CalendarViewBase( parent, name ), |
206 | mCalendar( calendar ), | 206 | mCalendar( calendar ), |
207 | mResourceManager( calendar->resourceManager() ) | 207 | mResourceManager( calendar->resourceManager() ) |
208 | { | 208 | { |
209 | 209 | ||
210 | mEventEditor = 0; | 210 | mEventEditor = 0; |
211 | mTodoEditor = 0; | 211 | mTodoEditor = 0; |
212 | 212 | ||
213 | init(); | 213 | init(); |
214 | } | 214 | } |
215 | 215 | ||
216 | CalendarView::CalendarView( Calendar *calendar, | 216 | CalendarView::CalendarView( Calendar *calendar, |
217 | QWidget *parent, const char *name ) | 217 | QWidget *parent, const char *name ) |
218 | : CalendarViewBase( parent, name ), | 218 | : CalendarViewBase( parent, name ), |
219 | mCalendar( calendar ), | 219 | mCalendar( calendar ), |
220 | mResourceManager( 0 ) | 220 | mResourceManager( 0 ) |
221 | { | 221 | { |
222 | 222 | ||
223 | mEventEditor = 0; | 223 | mEventEditor = 0; |
224 | mTodoEditor = 0; | 224 | mTodoEditor = 0; |
225 | init();} | 225 | init();} |
226 | 226 | ||
227 | void CalendarView::init() | 227 | void CalendarView::init() |
228 | { | 228 | { |
229 | beamDialog = new KOBeamPrefs(); | 229 | beamDialog = new KOBeamPrefs(); |
230 | mDatePickerMode = 0; | 230 | mDatePickerMode = 0; |
231 | mCurrentSyncDevice = ""; | 231 | mCurrentSyncDevice = ""; |
232 | writeLocale(); | 232 | writeLocale(); |
233 | mViewManager = new KOViewManager( this ); | 233 | mViewManager = new KOViewManager( this ); |
234 | mDialogManager = new KODialogManager( this ); | 234 | mDialogManager = new KODialogManager( this ); |
235 | mEventViewerDialog = 0; | 235 | mEventViewerDialog = 0; |
236 | mModified = false; | 236 | mModified = false; |
237 | mReadOnly = false; | 237 | mReadOnly = false; |
238 | mSelectedIncidence = 0; | 238 | mSelectedIncidence = 0; |
239 | mSyncProfiles.setAutoDelete(true); | ||
240 | mCalPrinter = 0; | 239 | mCalPrinter = 0; |
241 | mFilters.setAutoDelete(true); | 240 | mFilters.setAutoDelete(true); |
242 | 241 | ||
243 | mCalendar->registerObserver( this ); | 242 | mCalendar->registerObserver( this ); |
244 | // TODO: Make sure that view is updated, when calendar is changed. | 243 | // TODO: Make sure that view is updated, when calendar is changed. |
245 | 244 | ||
246 | mStorage = new FileStorage( mCalendar ); | 245 | mStorage = new FileStorage( mCalendar ); |
247 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 246 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
248 | 247 | ||
249 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 248 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
250 | #ifndef KORG_NOSPLITTER | 249 | #ifndef KORG_NOSPLITTER |
251 | // create the main layout frames. | 250 | // create the main layout frames. |
252 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 251 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
253 | topLayout->addWidget(mPanner); | 252 | topLayout->addWidget(mPanner); |
254 | 253 | ||
255 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 254 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
256 | "CalendarView::LeftFrame"); | 255 | "CalendarView::LeftFrame"); |
257 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 256 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
258 | 257 | ||
259 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 258 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
260 | "CalendarView::DateNavigator", QDate::currentDate() ); | 259 | "CalendarView::DateNavigator", QDate::currentDate() ); |
261 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 260 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
262 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 261 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
263 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 262 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
264 | 263 | ||
265 | #ifdef KORG_NORESOURCEVIEW | 264 | #ifdef KORG_NORESOURCEVIEW |
266 | mResourceView = 0; | 265 | mResourceView = 0; |
267 | #else | 266 | #else |
268 | if ( mResourceManager ) { | 267 | if ( mResourceManager ) { |
269 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 268 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
270 | mResourceView->updateView(); | 269 | mResourceView->updateView(); |
271 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 270 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
272 | SLOT( updateView() ) ); | 271 | SLOT( updateView() ) ); |
273 | } else { | 272 | } else { |
274 | mResourceView = 0; | 273 | mResourceView = 0; |
275 | } | 274 | } |
276 | #endif | 275 | #endif |
277 | QWidget *rightBox = new QWidget( mPanner ); | 276 | QWidget *rightBox = new QWidget( mPanner ); |
278 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 277 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
279 | 278 | ||
280 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 279 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
281 | rightLayout->addWidget( mNavigatorBar ); | 280 | rightLayout->addWidget( mNavigatorBar ); |
282 | 281 | ||
283 | mRightFrame = new QWidgetStack( rightBox ); | 282 | mRightFrame = new QWidgetStack( rightBox ); |
284 | rightLayout->addWidget( mRightFrame, 1 ); | 283 | rightLayout->addWidget( mRightFrame, 1 ); |
285 | 284 | ||
286 | mLeftFrame = mLeftSplitter; | 285 | mLeftFrame = mLeftSplitter; |
287 | #else | 286 | #else |
288 | QWidget *mainBox = new QWidget( this ); | 287 | QWidget *mainBox = new QWidget( this ); |
289 | QWidget *leftFrame = new QWidget( mainBox ); | 288 | QWidget *leftFrame = new QWidget( mainBox ); |
290 | 289 | ||
291 | QBoxLayout * mainBoxLayout; | 290 | QBoxLayout * mainBoxLayout; |
292 | QBoxLayout * leftFrameLayout; | 291 | QBoxLayout * leftFrameLayout; |
293 | if ( KOPrefs::instance()->mVerticalScreen ) { | 292 | if ( KOPrefs::instance()->mVerticalScreen ) { |
294 | mainBoxLayout = new QVBoxLayout(mainBox); | 293 | mainBoxLayout = new QVBoxLayout(mainBox); |
295 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 294 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
296 | } else { | 295 | } else { |
297 | mainBoxLayout = new QHBoxLayout(mainBox); | 296 | mainBoxLayout = new QHBoxLayout(mainBox); |
298 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 297 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
299 | } | 298 | } |
300 | topLayout->addWidget( mainBox ); | 299 | topLayout->addWidget( mainBox ); |
301 | mainBoxLayout->addWidget (leftFrame); | 300 | mainBoxLayout->addWidget (leftFrame); |
302 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 301 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
303 | "CalendarView::DateNavigator", QDate::currentDate()); | 302 | "CalendarView::DateNavigator", QDate::currentDate()); |
304 | // mDateNavigator->blockSignals( true ); | 303 | // mDateNavigator->blockSignals( true ); |
305 | leftFrameLayout->addWidget( mDateNavigator ); | 304 | leftFrameLayout->addWidget( mDateNavigator ); |
306 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 305 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
307 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); | 306 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); |
308 | 307 | ||
309 | if ( QApplication::desktop()->width() < 480 ) { | 308 | if ( QApplication::desktop()->width() < 480 ) { |
310 | leftFrameLayout->addWidget(mFilterView); | 309 | leftFrameLayout->addWidget(mFilterView); |
311 | leftFrameLayout->addWidget(mTodoList, 2 ); | 310 | leftFrameLayout->addWidget(mTodoList, 2 ); |
312 | 311 | ||
313 | } else { | 312 | } else { |
314 | leftFrameLayout->addWidget(mTodoList,2 ); | 313 | leftFrameLayout->addWidget(mTodoList,2 ); |
315 | leftFrameLayout->addWidget(mFilterView ); | 314 | leftFrameLayout->addWidget(mFilterView ); |
316 | } | 315 | } |
317 | mFilterView->hide(); | 316 | mFilterView->hide(); |
318 | QWidget *rightBox = new QWidget( mainBox ); | 317 | QWidget *rightBox = new QWidget( mainBox ); |
319 | mainBoxLayout->addWidget ( rightBox, 10 ); | 318 | mainBoxLayout->addWidget ( rightBox, 10 ); |
320 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 319 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
321 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 320 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
322 | mRightFrame = new QWidgetStack( rightBox ); | 321 | mRightFrame = new QWidgetStack( rightBox ); |
323 | rightLayout->addWidget( mNavigatorBar ); | 322 | rightLayout->addWidget( mNavigatorBar ); |
324 | rightLayout->addWidget( mRightFrame, 10 ); | 323 | rightLayout->addWidget( mRightFrame, 10 ); |
325 | 324 | ||
326 | mLeftFrame = leftFrame; | 325 | mLeftFrame = leftFrame; |
327 | if ( KOPrefs::instance()->mVerticalScreen ) { | 326 | if ( KOPrefs::instance()->mVerticalScreen ) { |
328 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 327 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
329 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 328 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
330 | } else { | 329 | } else { |
331 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 330 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
332 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 331 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
333 | } | 332 | } |
334 | 333 | ||
335 | //qDebug("Calendarview Size %d %d ", width(), height()); | 334 | //qDebug("Calendarview Size %d %d ", width(), height()); |
336 | #endif | 335 | #endif |
337 | 336 | ||
338 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 337 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
339 | SLOT( showDates( const KCal::DateList & ) ) ); | 338 | SLOT( showDates( const KCal::DateList & ) ) ); |
340 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 339 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
341 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 340 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
342 | 341 | ||
343 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 342 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
344 | mNavigator, SLOT( selectPreviousYear() ) ); | 343 | mNavigator, SLOT( selectPreviousYear() ) ); |
345 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 344 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
346 | mNavigator, SLOT( selectNextYear() ) ); | 345 | mNavigator, SLOT( selectNextYear() ) ); |
347 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 346 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
348 | mNavigator, SLOT( selectPreviousMonth() ) ); | 347 | mNavigator, SLOT( selectPreviousMonth() ) ); |
349 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 348 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
350 | mNavigator, SLOT( selectNextMonth() ) ); | 349 | mNavigator, SLOT( selectNextMonth() ) ); |
351 | 350 | ||
352 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 351 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
353 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 352 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
354 | 353 | ||
355 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 354 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
356 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 355 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
357 | 356 | ||
358 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 357 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
359 | mNavigator, SLOT( selectPreviousYear() ) ); | 358 | mNavigator, SLOT( selectPreviousYear() ) ); |
360 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 359 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
361 | mNavigator, SLOT( selectNextYear() ) ); | 360 | mNavigator, SLOT( selectNextYear() ) ); |
362 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 361 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
363 | mNavigator, SLOT( selectPreviousMonth() ) ); | 362 | mNavigator, SLOT( selectPreviousMonth() ) ); |
364 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 363 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
365 | mNavigator, SLOT( selectNextMonth() ) ); | 364 | mNavigator, SLOT( selectNextMonth() ) ); |
366 | 365 | ||
367 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 366 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
368 | mNavigator, SLOT( selectPrevious() ) ); | 367 | mNavigator, SLOT( selectPrevious() ) ); |
369 | connect( mDateNavigator, SIGNAL( goNext() ), | 368 | connect( mDateNavigator, SIGNAL( goNext() ), |
370 | mNavigator, SLOT( selectNext() ) ); | 369 | mNavigator, SLOT( selectNext() ) ); |
371 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 370 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
372 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 371 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
373 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 372 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
374 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 373 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
375 | 374 | ||
376 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 375 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
377 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 376 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
378 | 377 | ||
379 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 378 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
380 | SLOT( eventAdded( Event *) ) ); | 379 | SLOT( eventAdded( Event *) ) ); |
381 | 380 | ||
382 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 381 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
383 | 382 | ||
384 | connect( this, SIGNAL( configChanged() ), | 383 | connect( this, SIGNAL( configChanged() ), |
385 | mDateNavigator, SLOT( updateConfig() ) ); | 384 | mDateNavigator, SLOT( updateConfig() ) ); |
386 | 385 | ||
387 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 386 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
388 | SLOT( newTodo() ) ); | 387 | SLOT( newTodo() ) ); |
389 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 388 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
390 | SLOT( newSubTodo( Todo * ) ) ); | 389 | SLOT( newSubTodo( Todo * ) ) ); |
391 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 390 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
392 | SLOT( editTodo( Todo * ) ) ); | 391 | SLOT( editTodo( Todo * ) ) ); |
393 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 392 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
394 | SLOT( showTodo( Todo *) ) ); | 393 | SLOT( showTodo( Todo *) ) ); |
395 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 394 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
396 | SLOT( deleteTodo( Todo *) ) ); | 395 | SLOT( deleteTodo( Todo *) ) ); |
397 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 396 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
398 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 397 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
399 | SLOT( purgeCompleted() ) ); | 398 | SLOT( purgeCompleted() ) ); |
400 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 399 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
401 | SIGNAL( todoModified( Todo *, int ) ) ); | 400 | SIGNAL( todoModified( Todo *, int ) ) ); |
402 | 401 | ||
403 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 402 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
404 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 403 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
405 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 404 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
406 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 405 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
407 | 406 | ||
408 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 407 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
409 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 408 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
410 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
411 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 410 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
412 | 411 | ||
413 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 412 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
414 | this, SLOT ( todo_unsub( Todo * ) ) ); | 413 | this, SLOT ( todo_unsub( Todo * ) ) ); |
415 | 414 | ||
416 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 415 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
417 | SLOT( updateTodo( Todo *, int ) ) ); | 416 | SLOT( updateTodo( Todo *, int ) ) ); |
418 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 417 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
419 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 418 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
420 | 419 | ||
421 | 420 | ||
422 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 421 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
423 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 422 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
424 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 423 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
425 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 424 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
426 | 425 | ||
427 | 426 | ||
428 | 427 | ||
429 | 428 | ||
430 | 429 | ||
431 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 430 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
@@ -501,392 +500,394 @@ void CalendarView::checkNextTimerAlarm() | |||
501 | } | 500 | } |
502 | 501 | ||
503 | void CalendarView::computeAlarm( QString msg ) | 502 | void CalendarView::computeAlarm( QString msg ) |
504 | { | 503 | { |
505 | 504 | ||
506 | QString mess = msg; | 505 | QString mess = msg; |
507 | QString mAlarmMessage = mess.mid( 9 ); | 506 | QString mAlarmMessage = mess.mid( 9 ); |
508 | QString filename = MainWindow::resourcePath(); | 507 | QString filename = MainWindow::resourcePath(); |
509 | filename += "koalarm.wav"; | 508 | filename += "koalarm.wav"; |
510 | QString tempfilename; | 509 | QString tempfilename; |
511 | if ( mess.left( 13 ) == "suspend_alarm") { | 510 | if ( mess.left( 13 ) == "suspend_alarm") { |
512 | bool error = false; | 511 | bool error = false; |
513 | int len = mess.mid( 13 ).find("+++"); | 512 | int len = mess.mid( 13 ).find("+++"); |
514 | if ( len < 2 ) | 513 | if ( len < 2 ) |
515 | error = true; | 514 | error = true; |
516 | else { | 515 | else { |
517 | tempfilename = mess.mid( 13, len ); | 516 | tempfilename = mess.mid( 13, len ); |
518 | if ( !QFile::exists( tempfilename ) ) | 517 | if ( !QFile::exists( tempfilename ) ) |
519 | error = true; | 518 | error = true; |
520 | } | 519 | } |
521 | if ( ! error ) { | 520 | if ( ! error ) { |
522 | filename = tempfilename; | 521 | filename = tempfilename; |
523 | } | 522 | } |
524 | mAlarmMessage = mess.mid( 13+len+3 ); | 523 | mAlarmMessage = mess.mid( 13+len+3 ); |
525 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 524 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
526 | startAlarm( mAlarmMessage, filename); | 525 | startAlarm( mAlarmMessage, filename); |
527 | return; | 526 | return; |
528 | } | 527 | } |
529 | if ( mess.left( 11 ) == "timer_alarm") { | 528 | if ( mess.left( 11 ) == "timer_alarm") { |
530 | //mTimerTime = 0; | 529 | //mTimerTime = 0; |
531 | startAlarm( mess.mid( 11 ), filename ); | 530 | startAlarm( mess.mid( 11 ), filename ); |
532 | return; | 531 | return; |
533 | } | 532 | } |
534 | if ( mess.left( 10 ) == "proc_alarm") { | 533 | if ( mess.left( 10 ) == "proc_alarm") { |
535 | bool error = false; | 534 | bool error = false; |
536 | int len = mess.mid( 10 ).find("+++"); | 535 | int len = mess.mid( 10 ).find("+++"); |
537 | if ( len < 2 ) | 536 | if ( len < 2 ) |
538 | error = true; | 537 | error = true; |
539 | else { | 538 | else { |
540 | tempfilename = mess.mid( 10, len ); | 539 | tempfilename = mess.mid( 10, len ); |
541 | if ( !QFile::exists( tempfilename ) ) | 540 | if ( !QFile::exists( tempfilename ) ) |
542 | error = true; | 541 | error = true; |
543 | } | 542 | } |
544 | if ( error ) { | 543 | if ( error ) { |
545 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 544 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
546 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 545 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
547 | } else { | 546 | } else { |
548 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 547 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
549 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 548 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
550 | #ifndef _WIN32_ | 549 | #ifndef _WIN32_ |
551 | if ( vfork () == 0 ) { | 550 | if ( vfork () == 0 ) { |
552 | execl ( tempfilename.latin1(), 0 ); | 551 | execl ( tempfilename.latin1(), 0 ); |
553 | return; | 552 | return; |
554 | } | 553 | } |
555 | #else | 554 | #else |
556 | QProcess* p = new QProcess(); | 555 | QProcess* p = new QProcess(); |
557 | p->addArgument( tempfilename.latin1() ); | 556 | p->addArgument( tempfilename.latin1() ); |
558 | p->start(); | 557 | p->start(); |
559 | return; | 558 | return; |
560 | #endif | 559 | #endif |
561 | 560 | ||
562 | return; | 561 | return; |
563 | } | 562 | } |
564 | 563 | ||
565 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 564 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
566 | } | 565 | } |
567 | if ( mess.left( 11 ) == "audio_alarm") { | 566 | if ( mess.left( 11 ) == "audio_alarm") { |
568 | bool error = false; | 567 | bool error = false; |
569 | int len = mess.mid( 11 ).find("+++"); | 568 | int len = mess.mid( 11 ).find("+++"); |
570 | if ( len < 2 ) | 569 | if ( len < 2 ) |
571 | error = true; | 570 | error = true; |
572 | else { | 571 | else { |
573 | tempfilename = mess.mid( 11, len ); | 572 | tempfilename = mess.mid( 11, len ); |
574 | if ( !QFile::exists( tempfilename ) ) | 573 | if ( !QFile::exists( tempfilename ) ) |
575 | error = true; | 574 | error = true; |
576 | } | 575 | } |
577 | if ( ! error ) { | 576 | if ( ! error ) { |
578 | filename = tempfilename; | 577 | filename = tempfilename; |
579 | } | 578 | } |
580 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 579 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
581 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 580 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
582 | } | 581 | } |
583 | if ( mess.left( 9 ) == "cal_alarm") { | 582 | if ( mess.left( 9 ) == "cal_alarm") { |
584 | mAlarmMessage = mess.mid( 9 ) ; | 583 | mAlarmMessage = mess.mid( 9 ) ; |
585 | } | 584 | } |
586 | 585 | ||
587 | startAlarm( mAlarmMessage, filename ); | 586 | startAlarm( mAlarmMessage, filename ); |
588 | 587 | ||
589 | 588 | ||
590 | } | 589 | } |
591 | 590 | ||
592 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 591 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
593 | { | 592 | { |
594 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 593 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
595 | 594 | ||
596 | mSuspendAlarmNotification = noti; | 595 | mSuspendAlarmNotification = noti; |
597 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 596 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
598 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 597 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
599 | mSuspendTimer->start( ms , true ); | 598 | mSuspendTimer->start( ms , true ); |
600 | 599 | ||
601 | } | 600 | } |
602 | 601 | ||
603 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 602 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
604 | { | 603 | { |
605 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 604 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
606 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 605 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
607 | #ifndef DESKTOP_VERSION | 606 | #ifndef DESKTOP_VERSION |
608 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 607 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
609 | #endif | 608 | #endif |
610 | return; | 609 | return; |
611 | } | 610 | } |
612 | int maxSec; | 611 | int maxSec; |
613 | //maxSec = 5; //testing only | 612 | //maxSec = 5; //testing only |
614 | maxSec = 86400+3600; // one day+1hour | 613 | maxSec = 86400+3600; // one day+1hour |
615 | mAlarmNotification = noti; | 614 | mAlarmNotification = noti; |
616 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 615 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
617 | if ( sec > maxSec ) { | 616 | if ( sec > maxSec ) { |
618 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 617 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
619 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 618 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
620 | return; | 619 | return; |
621 | } else { | 620 | } else { |
622 | mRecheckAlarmTimer->stop(); | 621 | mRecheckAlarmTimer->stop(); |
623 | } | 622 | } |
624 | //qDebug("Alarm timer started with secs: %d ", sec); | 623 | //qDebug("Alarm timer started with secs: %d ", sec); |
625 | mAlarmTimer->start( sec *1000 , true ); | 624 | mAlarmTimer->start( sec *1000 , true ); |
626 | 625 | ||
627 | } | 626 | } |
628 | // called by mRecheckAlarmTimer to get next alarm | 627 | // called by mRecheckAlarmTimer to get next alarm |
629 | // we need this, because a QTimer has only a max range of 25 days | 628 | // we need this, because a QTimer has only a max range of 25 days |
630 | void CalendarView::recheckTimerAlarm() | 629 | void CalendarView::recheckTimerAlarm() |
631 | { | 630 | { |
632 | mAlarmTimer->stop(); | 631 | mAlarmTimer->stop(); |
633 | mRecheckAlarmTimer->stop(); | 632 | mRecheckAlarmTimer->stop(); |
634 | mCalendar->checkAlarmForIncidence( 0, true ); | 633 | mCalendar->checkAlarmForIncidence( 0, true ); |
635 | } | 634 | } |
636 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 635 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
637 | { | 636 | { |
638 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 637 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
639 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 638 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
640 | #ifndef DESKTOP_VERSION | 639 | #ifndef DESKTOP_VERSION |
641 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 640 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
642 | #endif | 641 | #endif |
643 | return; | 642 | return; |
644 | } | 643 | } |
645 | mAlarmTimer->stop(); | 644 | mAlarmTimer->stop(); |
646 | } | 645 | } |
647 | void CalendarView::selectWeekNum ( int num ) | 646 | void CalendarView::selectWeekNum ( int num ) |
648 | { | 647 | { |
649 | dateNavigator()->selectWeek( num ); | 648 | dateNavigator()->selectWeek( num ); |
650 | mViewManager->showWeekView(); | 649 | mViewManager->showWeekView(); |
651 | } | 650 | } |
652 | KOViewManager *CalendarView::viewManager() | 651 | KOViewManager *CalendarView::viewManager() |
653 | { | 652 | { |
654 | return mViewManager; | 653 | return mViewManager; |
655 | } | 654 | } |
656 | 655 | ||
657 | KODialogManager *CalendarView::dialogManager() | 656 | KODialogManager *CalendarView::dialogManager() |
658 | { | 657 | { |
659 | return mDialogManager; | 658 | return mDialogManager; |
660 | } | 659 | } |
661 | 660 | ||
662 | QDate CalendarView::startDate() | 661 | QDate CalendarView::startDate() |
663 | { | 662 | { |
664 | DateList dates = mNavigator->selectedDates(); | 663 | DateList dates = mNavigator->selectedDates(); |
665 | 664 | ||
666 | return dates.first(); | 665 | return dates.first(); |
667 | } | 666 | } |
668 | 667 | ||
669 | QDate CalendarView::endDate() | 668 | QDate CalendarView::endDate() |
670 | { | 669 | { |
671 | DateList dates = mNavigator->selectedDates(); | 670 | DateList dates = mNavigator->selectedDates(); |
672 | 671 | ||
673 | return dates.last(); | 672 | return dates.last(); |
674 | } | 673 | } |
675 | 674 | ||
676 | 675 | ||
677 | void CalendarView::createPrinter() | 676 | void CalendarView::createPrinter() |
678 | { | 677 | { |
679 | #ifndef KORG_NOPRINTER | 678 | #ifndef KORG_NOPRINTER |
680 | if (!mCalPrinter) { | 679 | if (!mCalPrinter) { |
681 | mCalPrinter = new CalPrinter(this, mCalendar); | 680 | mCalPrinter = new CalPrinter(this, mCalendar); |
682 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 681 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
683 | } | 682 | } |
684 | #endif | 683 | #endif |
685 | } | 684 | } |
686 | 685 | ||
687 | void CalendarView::confSync() | 686 | void CalendarView::confSync() |
688 | { | 687 | { |
689 | static KOSyncPrefsDialog* sp = 0; | 688 | static KOSyncPrefsDialog* sp = 0; |
690 | if ( ! sp ) { | 689 | if ( ! sp ) { |
691 | sp = new KOSyncPrefsDialog( this, "syncprefs", true ); | 690 | sp = new KOSyncPrefsDialog( this, "syncprefs", true ); |
692 | } | 691 | } |
692 | sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); | ||
693 | sp->usrReadConfig(); | 693 | sp->usrReadConfig(); |
694 | #ifndef DESKTOP_VERSION | 694 | #ifndef DESKTOP_VERSION |
695 | sp->showMaximized(); | 695 | sp->showMaximized(); |
696 | #else | 696 | #else |
697 | sp->show(); | 697 | sp->show(); |
698 | #endif | 698 | #endif |
699 | sp->exec(); | 699 | sp->exec(); |
700 | 700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | |
701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | ||
701 | } | 702 | } |
702 | 703 | ||
703 | 704 | ||
704 | //KOPrefs::instance()->mWriteBackFile | 705 | //KOPrefs::instance()->mWriteBackFile |
705 | //KOPrefs::instance()->mWriteBackExistingOnly | 706 | //KOPrefs::instance()->mWriteBackExistingOnly |
706 | 707 | ||
707 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
708 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
709 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
710 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
711 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
712 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
713 | 714 | ||
714 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
715 | { | 716 | { |
716 | 717 | ||
717 | //void setZaurusId(int id); | 718 | //void setZaurusId(int id); |
718 | // int zaurusId() const; | 719 | // int zaurusId() const; |
719 | // void setZaurusUid(int id); | 720 | // void setZaurusUid(int id); |
720 | // int zaurusUid() const; | 721 | // int zaurusUid() const; |
721 | // void setZaurusStat(int id); | 722 | // void setZaurusStat(int id); |
722 | // int zaurusStat() const; | 723 | // int zaurusStat() const; |
723 | // 0 equal | 724 | // 0 equal |
724 | // 1 take local | 725 | // 1 take local |
725 | // 2 take remote | 726 | // 2 take remote |
726 | // 3 cancel | 727 | // 3 cancel |
727 | QDateTime lastSync = mLastCalendarSync; | 728 | QDateTime lastSync = mLastCalendarSync; |
728 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
729 | bool remCh, locCh; | 730 | bool remCh, locCh; |
730 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); | 731 | remCh = ( remote->zaurusUid() != local->zaurusUid() ); |
731 | locCh = ( local->lastModified() > mLastCalendarSync ); | 732 | locCh = ( local->lastModified() > mLastCalendarSync ); |
732 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 733 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
733 | if ( !remCh && ! locCh ) { | 734 | if ( !remCh && ! locCh ) { |
734 | //qDebug("both not changed "); | 735 | //qDebug("both not changed "); |
735 | lastSync = local->lastModified().addDays(1); | 736 | lastSync = local->lastModified().addDays(1); |
736 | } else { | 737 | } else { |
737 | if ( locCh ) { | 738 | if ( locCh ) { |
738 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); | 739 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); |
739 | lastSync = local->lastModified().addDays( -1 ); | 740 | lastSync = local->lastModified().addDays( -1 ); |
740 | if ( !remCh ) | 741 | if ( !remCh ) |
741 | remote->setLastModified( lastSync.addDays( -1 ) ); | 742 | remote->setLastModified( lastSync.addDays( -1 ) ); |
742 | } else { | 743 | } else { |
743 | //qDebug(" not loc changed "); | 744 | //qDebug(" not loc changed "); |
744 | lastSync = local->lastModified().addDays( 1 ); | 745 | lastSync = local->lastModified().addDays( 1 ); |
745 | if ( remCh ) | 746 | if ( remCh ) |
746 | remote->setLastModified( lastSync.addDays( 1 ) ); | 747 | remote->setLastModified( lastSync.addDays( 1 ) ); |
747 | 748 | ||
748 | } | 749 | } |
749 | } | 750 | } |
750 | full = true; | 751 | full = true; |
751 | if ( mode < SYNC_PREF_ASK ) | 752 | if ( mode < SYNC_PREF_ASK ) |
752 | mode = SYNC_PREF_ASK; | 753 | mode = SYNC_PREF_ASK; |
753 | } else { | 754 | } else { |
754 | if ( local->lastModified() == remote->lastModified() ) | 755 | if ( local->lastModified() == remote->lastModified() ) |
755 | if ( local->revision() == remote->revision() ) | 756 | if ( local->revision() == remote->revision() ) |
756 | return 0; | 757 | return 0; |
757 | 758 | ||
758 | } | 759 | } |
759 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 760 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
760 | 761 | ||
761 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 762 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
762 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 763 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
763 | //full = true; //debug only | 764 | //full = true; //debug only |
764 | if ( full ) { | 765 | if ( full ) { |
765 | bool equ = false; | 766 | bool equ = false; |
766 | if ( local->type() == "Event" ) { | 767 | if ( local->type() == "Event" ) { |
767 | equ = (*((Event*) local) == *((Event*) remote)); | 768 | equ = (*((Event*) local) == *((Event*) remote)); |
768 | } | 769 | } |
769 | else if ( local->type() =="Todo" ) | 770 | else if ( local->type() =="Todo" ) |
770 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 771 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
771 | else if ( local->type() =="Journal" ) | 772 | else if ( local->type() =="Journal" ) |
772 | equ = (*((Journal*) local) == *((Journal*) remote)); | 773 | equ = (*((Journal*) local) == *((Journal*) remote)); |
773 | if ( equ ) { | 774 | if ( equ ) { |
774 | //qDebug("equal "); | 775 | //qDebug("equal "); |
775 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 776 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
776 | local->setZaurusUid( remote->zaurusUid() ); | 777 | local->setZaurusUid( remote->zaurusUid() ); |
777 | } | 778 | } |
778 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 779 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
779 | return 0; | 780 | return 0; |
780 | 781 | ||
781 | }//else //debug only | 782 | }//else //debug only |
782 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 783 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
783 | } | 784 | } |
784 | int result; | 785 | int result; |
785 | bool localIsNew; | 786 | bool localIsNew; |
786 | if ( full && mode < SYNC_PREF_NEWEST ) | 787 | if ( full && mode < SYNC_PREF_NEWEST ) |
787 | mode = SYNC_PREF_ASK; | 788 | mode = SYNC_PREF_ASK; |
788 | 789 | ||
789 | switch( mode ) { | 790 | switch( mode ) { |
790 | case SYNC_PREF_LOCAL: | 791 | case SYNC_PREF_LOCAL: |
791 | if ( lastSync > remote->lastModified() ) | 792 | if ( lastSync > remote->lastModified() ) |
792 | return 1; | 793 | return 1; |
793 | if ( lastSync > local->lastModified() ) | 794 | if ( lastSync > local->lastModified() ) |
794 | return 2; | 795 | return 2; |
795 | return 1; | 796 | return 1; |
796 | break; | 797 | break; |
797 | case SYNC_PREF_REMOTE: | 798 | case SYNC_PREF_REMOTE: |
798 | if ( lastSync > remote->lastModified() ) | 799 | if ( lastSync > remote->lastModified() ) |
799 | return 1; | 800 | return 1; |
800 | if ( lastSync > local->lastModified() ) | 801 | if ( lastSync > local->lastModified() ) |
801 | return 2; | 802 | return 2; |
802 | return 2; | 803 | return 2; |
803 | break; | 804 | break; |
804 | case SYNC_PREF_NEWEST: | 805 | case SYNC_PREF_NEWEST: |
805 | if ( local->lastModified() > remote->lastModified() ) | 806 | if ( local->lastModified() > remote->lastModified() ) |
806 | return 1; | 807 | return 1; |
807 | else | 808 | else |
808 | return 2; | 809 | return 2; |
809 | break; | 810 | break; |
810 | case SYNC_PREF_ASK: | 811 | case SYNC_PREF_ASK: |
811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 812 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
812 | if ( lastSync > remote->lastModified() ) | 813 | if ( lastSync > remote->lastModified() ) |
813 | return 1; | 814 | return 1; |
814 | if ( lastSync > local->lastModified() ) | 815 | if ( lastSync > local->lastModified() ) |
815 | return 2; | 816 | return 2; |
816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 817 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
817 | localIsNew = local->lastModified() > remote->lastModified(); | 818 | localIsNew = local->lastModified() > remote->lastModified(); |
818 | if ( localIsNew ) | 819 | if ( localIsNew ) |
819 | getEventViewerDialog()->setColorMode( 1 ); | 820 | getEventViewerDialog()->setColorMode( 1 ); |
820 | else | 821 | else |
821 | getEventViewerDialog()->setColorMode( 2 ); | 822 | getEventViewerDialog()->setColorMode( 2 ); |
822 | getEventViewerDialog()->setIncidence(local); | 823 | getEventViewerDialog()->setIncidence(local); |
823 | if ( localIsNew ) | 824 | if ( localIsNew ) |
824 | getEventViewerDialog()->setColorMode( 2 ); | 825 | getEventViewerDialog()->setColorMode( 2 ); |
825 | else | 826 | else |
826 | getEventViewerDialog()->setColorMode( 1 ); | 827 | getEventViewerDialog()->setColorMode( 1 ); |
827 | getEventViewerDialog()->addIncidence(remote); | 828 | getEventViewerDialog()->addIncidence(remote); |
828 | getEventViewerDialog()->setColorMode( 0 ); | 829 | getEventViewerDialog()->setColorMode( 0 ); |
829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 830 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 831 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
831 | getEventViewerDialog()->showMe(); | 832 | getEventViewerDialog()->showMe(); |
832 | result = getEventViewerDialog()->executeS( localIsNew ); | 833 | result = getEventViewerDialog()->executeS( localIsNew ); |
833 | return result; | 834 | return result; |
834 | 835 | ||
835 | break; | 836 | break; |
836 | case SYNC_PREF_FORCE_LOCAL: | 837 | case SYNC_PREF_FORCE_LOCAL: |
837 | return 1; | 838 | return 1; |
838 | break; | 839 | break; |
839 | case SYNC_PREF_FORCE_REMOTE: | 840 | case SYNC_PREF_FORCE_REMOTE: |
840 | return 2; | 841 | return 2; |
841 | break; | 842 | break; |
842 | 843 | ||
843 | default: | 844 | default: |
844 | // SYNC_PREF_TAKE_BOTH not implemented | 845 | // SYNC_PREF_TAKE_BOTH not implemented |
845 | break; | 846 | break; |
846 | } | 847 | } |
847 | return 0; | 848 | return 0; |
848 | } | 849 | } |
849 | Event* CalendarView::getLastSyncEvent() | 850 | Event* CalendarView::getLastSyncEvent() |
850 | { | 851 | { |
851 | Event* lse; | 852 | Event* lse; |
852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
853 | lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); | 854 | lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); |
854 | if (!lse) { | 855 | if (!lse) { |
855 | lse = new Event(); | 856 | lse = new Event(); |
856 | lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); | 857 | lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); |
857 | lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); | 858 | lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); |
858 | lse->setDtStart( mLastCalendarSync ); | 859 | lse->setDtStart( mLastCalendarSync ); |
859 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 860 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
860 | lse->setCategories( i18n("SyncEvent") ); | 861 | lse->setCategories( i18n("SyncEvent") ); |
861 | lse->setReadOnly( true ); | 862 | lse->setReadOnly( true ); |
862 | mCalendar->addEvent( lse ); | 863 | mCalendar->addEvent( lse ); |
863 | } | 864 | } |
864 | 865 | ||
865 | return lse; | 866 | return lse; |
866 | 867 | ||
867 | } | 868 | } |
868 | void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) | 869 | void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) |
869 | { | 870 | { |
870 | if ( ! lastSync ) | 871 | if ( ! lastSync ) |
871 | return; | 872 | return; |
872 | if ( toDelete->zaurusId() < 0 ) | 873 | if ( toDelete->zaurusId() < 0 ) |
873 | return; | 874 | return; |
874 | if ( toDelete->type() == "Journal" ) | 875 | if ( toDelete->type() == "Journal" ) |
875 | return; | 876 | return; |
876 | QString des = lastSync->description(); | 877 | QString des = lastSync->description(); |
877 | QString pref = "e"; | 878 | QString pref = "e"; |
878 | if ( toDelete->type() == "Todo" ) | 879 | if ( toDelete->type() == "Todo" ) |
879 | pref = "t"; | 880 | pref = "t"; |
880 | des += pref+ QString::number ( toDelete->zaurusId() ) + ","; | 881 | des += pref+ QString::number ( toDelete->zaurusId() ) + ","; |
881 | lastSync->setReadOnly( false ); | 882 | lastSync->setReadOnly( false ); |
882 | lastSync->setDescription( des ); | 883 | lastSync->setDescription( des ); |
883 | lastSync->setReadOnly( true ); | 884 | lastSync->setReadOnly( true ); |
884 | 885 | ||
885 | } | 886 | } |
886 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 887 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
887 | { | 888 | { |
888 | bool syncOK = true; | 889 | bool syncOK = true; |
889 | int addedEvent = 0; | 890 | int addedEvent = 0; |
890 | int addedEventR = 0; | 891 | int addedEventR = 0; |
891 | int deletedEventR = 0; | 892 | int deletedEventR = 0; |
892 | int deletedEventL = 0; | 893 | int deletedEventL = 0; |
@@ -1374,407 +1375,384 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1374 | } | 1375 | } |
1375 | globalFlagBlockAgenda = 2; | 1376 | globalFlagBlockAgenda = 2; |
1376 | // if ( getLastSyncEvent() ) | 1377 | // if ( getLastSyncEvent() ) |
1377 | // getLastSyncEvent()->setReadOnly( true ); | 1378 | // getLastSyncEvent()->setReadOnly( true ); |
1378 | mCalendar->reInitAlarmSettings(); | 1379 | mCalendar->reInitAlarmSettings(); |
1379 | setSyncEventsReadOnly(); | 1380 | setSyncEventsReadOnly(); |
1380 | updateUnmanagedViews(); | 1381 | updateUnmanagedViews(); |
1381 | updateView(); | 1382 | updateView(); |
1382 | if ( filename != MainWindow::defaultFileName() ) | 1383 | if ( filename != MainWindow::defaultFileName() ) |
1383 | saveCalendar( MainWindow::defaultFileName() ); | 1384 | saveCalendar( MainWindow::defaultFileName() ); |
1384 | loadedFileVersion = QDateTime::currentDateTime(); | 1385 | loadedFileVersion = QDateTime::currentDateTime(); |
1385 | return true; | 1386 | return true; |
1386 | } else { | 1387 | } else { |
1387 | // while failing to load, the calendar object could | 1388 | // while failing to load, the calendar object could |
1388 | // have become partially populated. Clear it out. | 1389 | // have become partially populated. Clear it out. |
1389 | if ( !merge ) mCalendar->close(); | 1390 | if ( !merge ) mCalendar->close(); |
1390 | 1391 | ||
1391 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1392 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1392 | 1393 | ||
1393 | globalFlagBlockAgenda = 2; | 1394 | globalFlagBlockAgenda = 2; |
1394 | updateView(); | 1395 | updateView(); |
1395 | } | 1396 | } |
1396 | return false; | 1397 | return false; |
1397 | } | 1398 | } |
1398 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1399 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1399 | { | 1400 | { |
1400 | loadedFileVersion = dt; | 1401 | loadedFileVersion = dt; |
1401 | } | 1402 | } |
1402 | bool CalendarView::checkFileChanged(QString fn) | 1403 | bool CalendarView::checkFileChanged(QString fn) |
1403 | { | 1404 | { |
1404 | QFileInfo finf ( fn ); | 1405 | QFileInfo finf ( fn ); |
1405 | if ( !finf.exists() ) | 1406 | if ( !finf.exists() ) |
1406 | return true; | 1407 | return true; |
1407 | QDateTime dt = finf.lastModified (); | 1408 | QDateTime dt = finf.lastModified (); |
1408 | if ( dt <= loadedFileVersion ) | 1409 | if ( dt <= loadedFileVersion ) |
1409 | return false; | 1410 | return false; |
1410 | return true; | 1411 | return true; |
1411 | 1412 | ||
1412 | } | 1413 | } |
1413 | bool CalendarView::checkFileVersion(QString fn) | 1414 | bool CalendarView::checkFileVersion(QString fn) |
1414 | { | 1415 | { |
1415 | QFileInfo finf ( fn ); | 1416 | QFileInfo finf ( fn ); |
1416 | if ( !finf.exists() ) | 1417 | if ( !finf.exists() ) |
1417 | return true; | 1418 | return true; |
1418 | QDateTime dt = finf.lastModified (); | 1419 | QDateTime dt = finf.lastModified (); |
1419 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1420 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1420 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1421 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1421 | if ( dt <= loadedFileVersion ) | 1422 | if ( dt <= loadedFileVersion ) |
1422 | return true; | 1423 | return true; |
1423 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1424 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , |
1424 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1425 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1425 | i18n("Sync+save")); | 1426 | i18n("Sync+save")); |
1426 | 1427 | ||
1427 | if ( km == KMessageBox::Cancel ) | 1428 | if ( km == KMessageBox::Cancel ) |
1428 | return false; | 1429 | return false; |
1429 | if ( km == KMessageBox::Yes ) | 1430 | if ( km == KMessageBox::Yes ) |
1430 | return true; | 1431 | return true; |
1431 | 1432 | ||
1432 | setSyncDevice("deleteaftersync" ); | 1433 | setSyncDevice("deleteaftersync" ); |
1433 | KOPrefs::instance()->mAskForPreferences = true; | 1434 | KOPrefs::instance()->mAskForPreferences = true; |
1434 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1435 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1435 | KOPrefs::instance()->mWriteBackFile = false; | 1436 | KOPrefs::instance()->mWriteBackFile = false; |
1436 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1437 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1437 | KOPrefs::instance()->mShowSyncSummary = false; | 1438 | KOPrefs::instance()->mShowSyncSummary = false; |
1438 | syncCalendar( fn, 3 ); | 1439 | syncCalendar( fn, 3 ); |
1439 | Event * e = getLastSyncEvent(); | 1440 | Event * e = getLastSyncEvent(); |
1440 | mCalendar->deleteEvent ( e ); | 1441 | mCalendar->deleteEvent ( e ); |
1441 | updateView(); | 1442 | updateView(); |
1442 | return true; | 1443 | return true; |
1443 | } | 1444 | } |
1444 | 1445 | ||
1445 | bool CalendarView::saveCalendar( QString filename ) | 1446 | bool CalendarView::saveCalendar( QString filename ) |
1446 | { | 1447 | { |
1447 | 1448 | ||
1448 | // Store back all unsaved data into calendar object | 1449 | // Store back all unsaved data into calendar object |
1449 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1450 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1450 | if ( mViewManager->currentView() ) | 1451 | if ( mViewManager->currentView() ) |
1451 | mViewManager->currentView()->flushView(); | 1452 | mViewManager->currentView()->flushView(); |
1452 | 1453 | ||
1453 | //mStorage->setFileName( filename ); | 1454 | //mStorage->setFileName( filename ); |
1454 | 1455 | ||
1455 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1456 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1456 | mStorage->setFileName( filename ); | 1457 | mStorage->setFileName( filename ); |
1457 | bool success; | 1458 | bool success; |
1458 | success = mStorage->save(); | 1459 | success = mStorage->save(); |
1459 | if ( !success ) { | 1460 | if ( !success ) { |
1460 | return false; | 1461 | return false; |
1461 | } | 1462 | } |
1462 | 1463 | ||
1463 | return true; | 1464 | return true; |
1464 | } | 1465 | } |
1465 | 1466 | ||
1466 | void CalendarView::closeCalendar() | 1467 | void CalendarView::closeCalendar() |
1467 | { | 1468 | { |
1468 | 1469 | ||
1469 | // child windows no longer valid | 1470 | // child windows no longer valid |
1470 | emit closingDown(); | 1471 | emit closingDown(); |
1471 | 1472 | ||
1472 | mCalendar->close(); | 1473 | mCalendar->close(); |
1473 | setModified(false); | 1474 | setModified(false); |
1474 | updateView(); | 1475 | updateView(); |
1475 | } | 1476 | } |
1476 | 1477 | ||
1477 | void CalendarView::archiveCalendar() | 1478 | void CalendarView::archiveCalendar() |
1478 | { | 1479 | { |
1479 | mDialogManager->showArchiveDialog(); | 1480 | mDialogManager->showArchiveDialog(); |
1480 | } | 1481 | } |
1481 | 1482 | ||
1482 | 1483 | ||
1483 | void CalendarView::readSettings() | 1484 | void CalendarView::readSettings() |
1484 | { | 1485 | { |
1485 | 1486 | ||
1486 | 1487 | ||
1487 | // mViewManager->showAgendaView(); | 1488 | // mViewManager->showAgendaView(); |
1488 | QString str; | 1489 | QString str; |
1489 | //qDebug("CalendarView::readSettings() "); | 1490 | //qDebug("CalendarView::readSettings() "); |
1490 | // read settings from the KConfig, supplying reasonable | 1491 | // read settings from the KConfig, supplying reasonable |
1491 | // defaults where none are to be found | 1492 | // defaults where none are to be found |
1492 | KConfig *config = KOGlobals::config(); | 1493 | KConfig *config = KOGlobals::config(); |
1493 | #ifndef KORG_NOSPLITTER | 1494 | #ifndef KORG_NOSPLITTER |
1494 | config->setGroup("KOrganizer Geometry"); | 1495 | config->setGroup("KOrganizer Geometry"); |
1495 | 1496 | ||
1496 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1497 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1497 | if (sizes.count() != 2) { | 1498 | if (sizes.count() != 2) { |
1498 | sizes << mDateNavigator->minimumSizeHint().width(); | 1499 | sizes << mDateNavigator->minimumSizeHint().width(); |
1499 | sizes << 300; | 1500 | sizes << 300; |
1500 | } | 1501 | } |
1501 | mPanner->setSizes(sizes); | 1502 | mPanner->setSizes(sizes); |
1502 | 1503 | ||
1503 | sizes = config->readIntListEntry("Separator2"); | 1504 | sizes = config->readIntListEntry("Separator2"); |
1504 | if ( ( mResourceView && sizes.count() == 4 ) || | 1505 | if ( ( mResourceView && sizes.count() == 4 ) || |
1505 | ( !mResourceView && sizes.count() == 3 ) ) { | 1506 | ( !mResourceView && sizes.count() == 3 ) ) { |
1506 | mLeftSplitter->setSizes(sizes); | 1507 | mLeftSplitter->setSizes(sizes); |
1507 | } | 1508 | } |
1508 | #endif | 1509 | #endif |
1509 | globalFlagBlockAgenda = 1; | 1510 | globalFlagBlockAgenda = 1; |
1510 | mViewManager->showAgendaView(); | 1511 | mViewManager->showAgendaView(); |
1511 | //mViewManager->readSettings( config ); | 1512 | //mViewManager->readSettings( config ); |
1512 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1513 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1513 | readFilterSettings(config); | 1514 | readFilterSettings(config); |
1514 | config->setGroup( "Views" ); | 1515 | config->setGroup( "Views" ); |
1515 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1516 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1516 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1517 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1517 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1518 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1518 | else mNavigator->selectDates( dateCount ); | 1519 | else mNavigator->selectDates( dateCount ); |
1519 | // mViewManager->readSettings( config ); | 1520 | // mViewManager->readSettings( config ); |
1520 | updateConfig(); | 1521 | updateConfig(); |
1521 | globalFlagBlockAgenda = 2; | 1522 | globalFlagBlockAgenda = 2; |
1522 | mViewManager->readSettings( config ); | 1523 | mViewManager->readSettings( config ); |
1523 | #ifdef DESKTOP_VERSION | 1524 | #ifdef DESKTOP_VERSION |
1524 | config->setGroup("WidgetLayout"); | 1525 | config->setGroup("WidgetLayout"); |
1525 | QStringList list; | 1526 | QStringList list; |
1526 | list = config->readListEntry("MainLayout"); | 1527 | list = config->readListEntry("MainLayout"); |
1527 | int x,y,w,h; | 1528 | int x,y,w,h; |
1528 | if ( ! list.isEmpty() ) { | 1529 | if ( ! list.isEmpty() ) { |
1529 | x = list[0].toInt(); | 1530 | x = list[0].toInt(); |
1530 | y = list[1].toInt(); | 1531 | y = list[1].toInt(); |
1531 | w = list[2].toInt(); | 1532 | w = list[2].toInt(); |
1532 | h = list[3].toInt(); | 1533 | h = list[3].toInt(); |
1533 | topLevelWidget()->setGeometry(x,y,w,h); | 1534 | topLevelWidget()->setGeometry(x,y,w,h); |
1534 | 1535 | ||
1535 | } else { | 1536 | } else { |
1536 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1537 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1537 | } | 1538 | } |
1538 | list = config->readListEntry("EditEventLayout"); | 1539 | list = config->readListEntry("EditEventLayout"); |
1539 | if ( ! list.isEmpty() ) { | 1540 | if ( ! list.isEmpty() ) { |
1540 | x = list[0].toInt(); | 1541 | x = list[0].toInt(); |
1541 | y = list[1].toInt(); | 1542 | y = list[1].toInt(); |
1542 | w = list[2].toInt(); | 1543 | w = list[2].toInt(); |
1543 | h = list[3].toInt(); | 1544 | h = list[3].toInt(); |
1544 | mEventEditor->setGeometry(x,y,w,h); | 1545 | mEventEditor->setGeometry(x,y,w,h); |
1545 | 1546 | ||
1546 | } | 1547 | } |
1547 | list = config->readListEntry("EditTodoLayout"); | 1548 | list = config->readListEntry("EditTodoLayout"); |
1548 | if ( ! list.isEmpty() ) { | 1549 | if ( ! list.isEmpty() ) { |
1549 | x = list[0].toInt(); | 1550 | x = list[0].toInt(); |
1550 | y = list[1].toInt(); | 1551 | y = list[1].toInt(); |
1551 | w = list[2].toInt(); | 1552 | w = list[2].toInt(); |
1552 | h = list[3].toInt(); | 1553 | h = list[3].toInt(); |
1553 | mTodoEditor->setGeometry(x,y,w,h); | 1554 | mTodoEditor->setGeometry(x,y,w,h); |
1554 | 1555 | ||
1555 | } | 1556 | } |
1556 | list = config->readListEntry("ViewerLayout"); | 1557 | list = config->readListEntry("ViewerLayout"); |
1557 | if ( ! list.isEmpty() ) { | 1558 | if ( ! list.isEmpty() ) { |
1558 | x = list[0].toInt(); | 1559 | x = list[0].toInt(); |
1559 | y = list[1].toInt(); | 1560 | y = list[1].toInt(); |
1560 | w = list[2].toInt(); | 1561 | w = list[2].toInt(); |
1561 | h = list[3].toInt(); | 1562 | h = list[3].toInt(); |
1562 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1563 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1563 | } | 1564 | } |
1564 | #endif | 1565 | #endif |
1565 | 1566 | ||
1566 | |||
1567 | // pending read sync settings; | ||
1568 | mSyncProfileNames.clear(); | ||
1569 | mSyncProfileNames << "Profile_1"; | ||
1570 | mSyncProfileNames << "Profile_2"; | ||
1571 | mSyncProfileNames << "Profile_3"; | ||
1572 | mSyncProfileNames << "Profile_4"; | ||
1573 | mSyncProfileNames << "Profile_5"; | ||
1574 | KSyncProfile* temp = new KSyncProfile (); | ||
1575 | temp->setName("Profile_1" ); | ||
1576 | mSyncProfiles.append( temp ); | ||
1577 | temp = new KSyncProfile (); | ||
1578 | temp->setName("Profile_2" ); | ||
1579 | mSyncProfiles.append( temp ); | ||
1580 | temp = new KSyncProfile (); | ||
1581 | temp->setName("Profile_3" ); | ||
1582 | mSyncProfiles.append( temp ); | ||
1583 | temp = new KSyncProfile (); | ||
1584 | temp->setName("Profile_4" ); | ||
1585 | mSyncProfiles.append( temp ); | ||
1586 | temp = new KSyncProfile (); | ||
1587 | temp->setName("Profile_5" ); | ||
1588 | mSyncProfiles.append( temp ); | ||
1589 | } | 1567 | } |
1590 | 1568 | ||
1591 | 1569 | ||
1592 | void CalendarView::writeSettings() | 1570 | void CalendarView::writeSettings() |
1593 | { | 1571 | { |
1594 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1572 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1595 | 1573 | ||
1596 | KConfig *config = KOGlobals::config(); | 1574 | KConfig *config = KOGlobals::config(); |
1597 | 1575 | ||
1598 | #ifndef KORG_NOSPLITTER | 1576 | #ifndef KORG_NOSPLITTER |
1599 | config->setGroup("KOrganizer Geometry"); | 1577 | config->setGroup("KOrganizer Geometry"); |
1600 | 1578 | ||
1601 | QValueList<int> list = mPanner->sizes(); | 1579 | QValueList<int> list = mPanner->sizes(); |
1602 | config->writeEntry("Separator1",list); | 1580 | config->writeEntry("Separator1",list); |
1603 | 1581 | ||
1604 | list = mLeftSplitter->sizes(); | 1582 | list = mLeftSplitter->sizes(); |
1605 | config->writeEntry("Separator2",list); | 1583 | config->writeEntry("Separator2",list); |
1606 | #endif | 1584 | #endif |
1607 | 1585 | ||
1608 | mViewManager->writeSettings( config ); | 1586 | mViewManager->writeSettings( config ); |
1609 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1587 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1610 | mDialogManager->writeSettings( config ); | 1588 | mDialogManager->writeSettings( config ); |
1611 | //KOPrefs::instance()->usrWriteConfig(); | 1589 | //KOPrefs::instance()->usrWriteConfig(); |
1612 | KOPrefs::instance()->writeConfig(); | 1590 | KOPrefs::instance()->writeConfig(); |
1613 | 1591 | ||
1614 | writeFilterSettings(config); | 1592 | writeFilterSettings(config); |
1615 | 1593 | ||
1616 | config->setGroup( "Views" ); | 1594 | config->setGroup( "Views" ); |
1617 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1595 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1618 | 1596 | ||
1619 | #ifdef DESKTOP_VERSION | 1597 | #ifdef DESKTOP_VERSION |
1620 | config->setGroup("WidgetLayout"); | 1598 | config->setGroup("WidgetLayout"); |
1621 | QStringList list ;//= config->readListEntry("MainLayout"); | 1599 | QStringList list ;//= config->readListEntry("MainLayout"); |
1622 | int x,y,w,h; | 1600 | int x,y,w,h; |
1623 | QWidget* wid; | 1601 | QWidget* wid; |
1624 | wid = topLevelWidget(); | 1602 | wid = topLevelWidget(); |
1625 | x = wid->geometry().x(); | 1603 | x = wid->geometry().x(); |
1626 | y = wid->geometry().y(); | 1604 | y = wid->geometry().y(); |
1627 | w = wid->width(); | 1605 | w = wid->width(); |
1628 | h = wid->height(); | 1606 | h = wid->height(); |
1629 | list.clear(); | 1607 | list.clear(); |
1630 | list << QString::number( x ); | 1608 | list << QString::number( x ); |
1631 | list << QString::number( y ); | 1609 | list << QString::number( y ); |
1632 | list << QString::number( w ); | 1610 | list << QString::number( w ); |
1633 | list << QString::number( h ); | 1611 | list << QString::number( h ); |
1634 | config->writeEntry("MainLayout",list ); | 1612 | config->writeEntry("MainLayout",list ); |
1635 | 1613 | ||
1636 | wid = mEventEditor; | 1614 | wid = mEventEditor; |
1637 | x = wid->geometry().x(); | 1615 | x = wid->geometry().x(); |
1638 | y = wid->geometry().y(); | 1616 | y = wid->geometry().y(); |
1639 | w = wid->width(); | 1617 | w = wid->width(); |
1640 | h = wid->height(); | 1618 | h = wid->height(); |
1641 | list.clear(); | 1619 | list.clear(); |
1642 | list << QString::number( x ); | 1620 | list << QString::number( x ); |
1643 | list << QString::number( y ); | 1621 | list << QString::number( y ); |
1644 | list << QString::number( w ); | 1622 | list << QString::number( w ); |
1645 | list << QString::number( h ); | 1623 | list << QString::number( h ); |
1646 | config->writeEntry("EditEventLayout",list ); | 1624 | config->writeEntry("EditEventLayout",list ); |
1647 | 1625 | ||
1648 | wid = mTodoEditor; | 1626 | wid = mTodoEditor; |
1649 | x = wid->geometry().x(); | 1627 | x = wid->geometry().x(); |
1650 | y = wid->geometry().y(); | 1628 | y = wid->geometry().y(); |
1651 | w = wid->width(); | 1629 | w = wid->width(); |
1652 | h = wid->height(); | 1630 | h = wid->height(); |
1653 | list.clear(); | 1631 | list.clear(); |
1654 | list << QString::number( x ); | 1632 | list << QString::number( x ); |
1655 | list << QString::number( y ); | 1633 | list << QString::number( y ); |
1656 | list << QString::number( w ); | 1634 | list << QString::number( w ); |
1657 | list << QString::number( h ); | 1635 | list << QString::number( h ); |
1658 | config->writeEntry("EditTodoLayout",list ); | 1636 | config->writeEntry("EditTodoLayout",list ); |
1659 | wid = getEventViewerDialog(); | 1637 | wid = getEventViewerDialog(); |
1660 | x = wid->geometry().x(); | 1638 | x = wid->geometry().x(); |
1661 | y = wid->geometry().y(); | 1639 | y = wid->geometry().y(); |
1662 | w = wid->width(); | 1640 | w = wid->width(); |
1663 | h = wid->height(); | 1641 | h = wid->height(); |
1664 | list.clear(); | 1642 | list.clear(); |
1665 | list << QString::number( x ); | 1643 | list << QString::number( x ); |
1666 | list << QString::number( y ); | 1644 | list << QString::number( y ); |
1667 | list << QString::number( w ); | 1645 | list << QString::number( w ); |
1668 | list << QString::number( h ); | 1646 | list << QString::number( h ); |
1669 | config->writeEntry("ViewerLayout",list ); | 1647 | config->writeEntry("ViewerLayout",list ); |
1670 | wid = mDialogManager->getSearchDialog(); | 1648 | wid = mDialogManager->getSearchDialog(); |
1671 | if ( wid ) { | 1649 | if ( wid ) { |
1672 | x = wid->geometry().x(); | 1650 | x = wid->geometry().x(); |
1673 | y = wid->geometry().y(); | 1651 | y = wid->geometry().y(); |
1674 | w = wid->width(); | 1652 | w = wid->width(); |
1675 | h = wid->height(); | 1653 | h = wid->height(); |
1676 | list.clear(); | 1654 | list.clear(); |
1677 | list << QString::number( x ); | 1655 | list << QString::number( x ); |
1678 | list << QString::number( y ); | 1656 | list << QString::number( y ); |
1679 | list << QString::number( w ); | 1657 | list << QString::number( w ); |
1680 | list << QString::number( h ); | 1658 | list << QString::number( h ); |
1681 | config->writeEntry("SearchLayout",list ); | 1659 | config->writeEntry("SearchLayout",list ); |
1682 | } | 1660 | } |
1683 | #endif | 1661 | #endif |
1684 | 1662 | ||
1685 | 1663 | ||
1686 | config->sync(); | 1664 | config->sync(); |
1687 | } | 1665 | } |
1688 | 1666 | ||
1689 | void CalendarView::readFilterSettings(KConfig *config) | 1667 | void CalendarView::readFilterSettings(KConfig *config) |
1690 | { | 1668 | { |
1691 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1669 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1692 | 1670 | ||
1693 | mFilters.clear(); | 1671 | mFilters.clear(); |
1694 | 1672 | ||
1695 | config->setGroup("General"); | 1673 | config->setGroup("General"); |
1696 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1674 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1697 | 1675 | ||
1698 | QStringList::ConstIterator it = filterList.begin(); | 1676 | QStringList::ConstIterator it = filterList.begin(); |
1699 | QStringList::ConstIterator end = filterList.end(); | 1677 | QStringList::ConstIterator end = filterList.end(); |
1700 | while(it != end) { | 1678 | while(it != end) { |
1701 | // kdDebug() << " filter: " << (*it) << endl; | 1679 | // kdDebug() << " filter: " << (*it) << endl; |
1702 | 1680 | ||
1703 | CalFilter *filter; | 1681 | CalFilter *filter; |
1704 | filter = new CalFilter(*it); | 1682 | filter = new CalFilter(*it); |
1705 | config->setGroup("Filter_" + (*it)); | 1683 | config->setGroup("Filter_" + (*it)); |
1706 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1684 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1707 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1685 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1708 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1686 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1709 | mFilters.append(filter); | 1687 | mFilters.append(filter); |
1710 | 1688 | ||
1711 | ++it; | 1689 | ++it; |
1712 | } | 1690 | } |
1713 | 1691 | ||
1714 | if (mFilters.count() == 0) { | 1692 | if (mFilters.count() == 0) { |
1715 | CalFilter *filter = new CalFilter(i18n("Default")); | 1693 | CalFilter *filter = new CalFilter(i18n("Default")); |
1716 | mFilters.append(filter); | 1694 | mFilters.append(filter); |
1717 | } | 1695 | } |
1718 | mFilterView->updateFilters(); | 1696 | mFilterView->updateFilters(); |
1719 | config->setGroup("FilterView"); | 1697 | config->setGroup("FilterView"); |
1720 | 1698 | ||
1721 | mFilterView->blockSignals(true); | 1699 | mFilterView->blockSignals(true); |
1722 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1700 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1723 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1701 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1724 | mFilterView->blockSignals(false); | 1702 | mFilterView->blockSignals(false); |
1725 | // We do it manually to avoid it being done twice by the above calls | 1703 | // We do it manually to avoid it being done twice by the above calls |
1726 | updateFilter(); | 1704 | updateFilter(); |
1727 | } | 1705 | } |
1728 | 1706 | ||
1729 | void CalendarView::writeFilterSettings(KConfig *config) | 1707 | void CalendarView::writeFilterSettings(KConfig *config) |
1730 | { | 1708 | { |
1731 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1709 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1732 | 1710 | ||
1733 | QStringList filterList; | 1711 | QStringList filterList; |
1734 | 1712 | ||
1735 | CalFilter *filter = mFilters.first(); | 1713 | CalFilter *filter = mFilters.first(); |
1736 | while(filter) { | 1714 | while(filter) { |
1737 | // kdDebug() << " fn: " << filter->name() << endl; | 1715 | // kdDebug() << " fn: " << filter->name() << endl; |
1738 | filterList << filter->name(); | 1716 | filterList << filter->name(); |
1739 | config->setGroup("Filter_" + filter->name()); | 1717 | config->setGroup("Filter_" + filter->name()); |
1740 | config->writeEntry("Criteria",filter->criteria()); | 1718 | config->writeEntry("Criteria",filter->criteria()); |
1741 | config->writeEntry("CategoryList",filter->categoryList()); | 1719 | config->writeEntry("CategoryList",filter->categoryList()); |
1742 | filter = mFilters.next(); | 1720 | filter = mFilters.next(); |
1743 | } | 1721 | } |
1744 | config->setGroup("General"); | 1722 | config->setGroup("General"); |
1745 | config->writeEntry("CalendarFilters",filterList); | 1723 | config->writeEntry("CalendarFilters",filterList); |
1746 | 1724 | ||
1747 | config->setGroup("FilterView"); | 1725 | config->setGroup("FilterView"); |
1748 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1726 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1749 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1727 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1750 | } | 1728 | } |
1751 | 1729 | ||
1752 | 1730 | ||
1753 | void CalendarView::goToday() | 1731 | void CalendarView::goToday() |
1754 | { | 1732 | { |
1755 | mNavigator->selectToday(); | 1733 | mNavigator->selectToday(); |
1756 | } | 1734 | } |
1757 | 1735 | ||
1758 | void CalendarView::goNext() | 1736 | void CalendarView::goNext() |
1759 | { | 1737 | { |
1760 | mNavigator->selectNext(); | 1738 | mNavigator->selectNext(); |
1761 | } | 1739 | } |
1762 | 1740 | ||
1763 | void CalendarView::goPrevious() | 1741 | void CalendarView::goPrevious() |
1764 | { | 1742 | { |
1765 | mNavigator->selectPrevious(); | 1743 | mNavigator->selectPrevious(); |
1766 | } | 1744 | } |
1767 | void CalendarView::goNextMonth() | 1745 | void CalendarView::goNextMonth() |
1768 | { | 1746 | { |
1769 | mNavigator->selectNextMonth(); | 1747 | mNavigator->selectNextMonth(); |
1770 | } | 1748 | } |
1771 | 1749 | ||
1772 | void CalendarView::goPreviousMonth() | 1750 | void CalendarView::goPreviousMonth() |
1773 | { | 1751 | { |
1774 | mNavigator->selectPreviousMonth(); | 1752 | mNavigator->selectPreviousMonth(); |
1775 | } | 1753 | } |
1776 | void CalendarView::writeLocale() | 1754 | void CalendarView::writeLocale() |
1777 | { | 1755 | { |
1778 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1756 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1779 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1757 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1780 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1758 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index fda02f7..8aa5e1c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -293,296 +293,294 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
293 | 293 | ||
294 | /** Full update of visible todo views */ | 294 | /** Full update of visible todo views */ |
295 | void updateTodoViews(); | 295 | void updateTodoViews(); |
296 | 296 | ||
297 | void updateUnmanagedViews(); | 297 | void updateUnmanagedViews(); |
298 | 298 | ||
299 | /** cut the current appointment to the clipboard */ | 299 | /** cut the current appointment to the clipboard */ |
300 | void edit_cut(); | 300 | void edit_cut(); |
301 | 301 | ||
302 | /** copy the current appointment(s) to the clipboard */ | 302 | /** copy the current appointment(s) to the clipboard */ |
303 | void edit_copy(); | 303 | void edit_copy(); |
304 | 304 | ||
305 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 305 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
306 | void edit_paste(); | 306 | void edit_paste(); |
307 | 307 | ||
308 | /** edit viewing and configuration options. */ | 308 | /** edit viewing and configuration options. */ |
309 | void edit_options(); | 309 | void edit_options(); |
310 | void edit_sync_options(); | 310 | void edit_sync_options(); |
311 | /** | 311 | /** |
312 | Functions for printing, previewing a print, and setting up printing | 312 | Functions for printing, previewing a print, and setting up printing |
313 | parameters. | 313 | parameters. |
314 | */ | 314 | */ |
315 | void print(); | 315 | void print(); |
316 | void printSetup(); | 316 | void printSetup(); |
317 | void printPreview(); | 317 | void printPreview(); |
318 | 318 | ||
319 | /** Export as iCalendar file */ | 319 | /** Export as iCalendar file */ |
320 | void exportICalendar(); | 320 | void exportICalendar(); |
321 | 321 | ||
322 | /** Export as vCalendar file */ | 322 | /** Export as vCalendar file */ |
323 | bool exportVCalendar( QString fn); | 323 | bool exportVCalendar( QString fn); |
324 | 324 | ||
325 | /** pop up a dialog to show an existing appointment. */ | 325 | /** pop up a dialog to show an existing appointment. */ |
326 | void appointment_show(); | 326 | void appointment_show(); |
327 | /** | 327 | /** |
328 | * pop up an Appointment Dialog to edit an existing appointment.Get | 328 | * pop up an Appointment Dialog to edit an existing appointment.Get |
329 | * information on the appointment from the list of unique IDs that is | 329 | * information on the appointment from the list of unique IDs that is |
330 | * currently in the View, called currIds. | 330 | * currently in the View, called currIds. |
331 | */ | 331 | */ |
332 | void appointment_edit(); | 332 | void appointment_edit(); |
333 | /** | 333 | /** |
334 | * pop up dialog confirming deletion of currently selected event in the | 334 | * pop up dialog confirming deletion of currently selected event in the |
335 | * View. | 335 | * View. |
336 | */ | 336 | */ |
337 | void appointment_delete(); | 337 | void appointment_delete(); |
338 | 338 | ||
339 | /** mails the currently selected event to a particular user as a vCalendar | 339 | /** mails the currently selected event to a particular user as a vCalendar |
340 | attachment. */ | 340 | attachment. */ |
341 | void action_mail(); | 341 | void action_mail(); |
342 | 342 | ||
343 | /* frees a subtodo from it's relation */ | 343 | /* frees a subtodo from it's relation */ |
344 | void todo_unsub( Todo * ); | 344 | void todo_unsub( Todo * ); |
345 | 345 | ||
346 | /** Take ownership of selected event. */ | 346 | /** Take ownership of selected event. */ |
347 | void takeOverEvent(); | 347 | void takeOverEvent(); |
348 | 348 | ||
349 | /** Take ownership of all events in calendar. */ | 349 | /** Take ownership of all events in calendar. */ |
350 | void takeOverCalendar(); | 350 | void takeOverCalendar(); |
351 | 351 | ||
352 | /** query whether or not the calendar is "dirty". */ | 352 | /** query whether or not the calendar is "dirty". */ |
353 | bool isModified(); | 353 | bool isModified(); |
354 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 354 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
355 | void setModified(bool modified=true); | 355 | void setModified(bool modified=true); |
356 | 356 | ||
357 | /** query if the calendar is read-only. */ | 357 | /** query if the calendar is read-only. */ |
358 | bool isReadOnly(); | 358 | bool isReadOnly(); |
359 | /** set state of calendar to read-only */ | 359 | /** set state of calendar to read-only */ |
360 | void setReadOnly(bool readOnly=true); | 360 | void setReadOnly(bool readOnly=true); |
361 | 361 | ||
362 | void eventUpdated(Incidence *); | 362 | void eventUpdated(Incidence *); |
363 | 363 | ||
364 | /* iTIP scheduling actions */ | 364 | /* iTIP scheduling actions */ |
365 | void schedule_publish(Incidence *incidence = 0); | 365 | void schedule_publish(Incidence *incidence = 0); |
366 | void schedule_request(Incidence *incidence = 0); | 366 | void schedule_request(Incidence *incidence = 0); |
367 | void schedule_refresh(Incidence *incidence = 0); | 367 | void schedule_refresh(Incidence *incidence = 0); |
368 | void schedule_cancel(Incidence *incidence = 0); | 368 | void schedule_cancel(Incidence *incidence = 0); |
369 | void schedule_add(Incidence *incidence = 0); | 369 | void schedule_add(Incidence *incidence = 0); |
370 | void schedule_reply(Incidence *incidence = 0); | 370 | void schedule_reply(Incidence *incidence = 0); |
371 | void schedule_counter(Incidence *incidence = 0); | 371 | void schedule_counter(Incidence *incidence = 0); |
372 | void schedule_declinecounter(Incidence *incidence = 0); | 372 | void schedule_declinecounter(Incidence *incidence = 0); |
373 | void schedule_publish_freebusy(int daysToPublish = 30); | 373 | void schedule_publish_freebusy(int daysToPublish = 30); |
374 | 374 | ||
375 | void openAddressbook(); | 375 | void openAddressbook(); |
376 | 376 | ||
377 | void editFilters(); | 377 | void editFilters(); |
378 | void toggleFilerEnabled(); | 378 | void toggleFilerEnabled(); |
379 | 379 | ||
380 | void toggleFilter(); | 380 | void toggleFilter(); |
381 | void showFilter(bool visible); | 381 | void showFilter(bool visible); |
382 | void updateFilter(); | 382 | void updateFilter(); |
383 | void filterEdited(); | 383 | void filterEdited(); |
384 | void selectFilter( int ); | 384 | void selectFilter( int ); |
385 | 385 | ||
386 | void showIntro(); | 386 | void showIntro(); |
387 | 387 | ||
388 | /** Move the curdatepient view date to today */ | 388 | /** Move the curdatepient view date to today */ |
389 | void goToday(); | 389 | void goToday(); |
390 | 390 | ||
391 | /** Move to the next date(s) in the current view */ | 391 | /** Move to the next date(s) in the current view */ |
392 | void goNext(); | 392 | void goNext(); |
393 | 393 | ||
394 | /** Move to the previous date(s) in the current view */ | 394 | /** Move to the previous date(s) in the current view */ |
395 | void goPrevious(); | 395 | void goPrevious(); |
396 | /** Move to the next date(s) in the current view */ | 396 | /** Move to the next date(s) in the current view */ |
397 | void goNextMonth(); | 397 | void goNextMonth(); |
398 | 398 | ||
399 | /** Move to the previous date(s) in the current view */ | 399 | /** Move to the previous date(s) in the current view */ |
400 | void goPreviousMonth(); | 400 | void goPreviousMonth(); |
401 | 401 | ||
402 | void toggleExpand(); | 402 | void toggleExpand(); |
403 | void toggleDateNavigatorWidget(); | 403 | void toggleDateNavigatorWidget(); |
404 | void toggleAllDaySize(); | 404 | void toggleAllDaySize(); |
405 | void dialogClosing(Incidence *); | 405 | void dialogClosing(Incidence *); |
406 | 406 | ||
407 | /** Look for new messages in the inbox */ | 407 | /** Look for new messages in the inbox */ |
408 | void lookForIncomingMessages(); | 408 | void lookForIncomingMessages(); |
409 | /** Look for new messages in the outbox */ | 409 | /** Look for new messages in the outbox */ |
410 | void lookForOutgoingMessages(); | 410 | void lookForOutgoingMessages(); |
411 | 411 | ||
412 | void processMainViewSelection( Incidence * ); | 412 | void processMainViewSelection( Incidence * ); |
413 | void processTodoListSelection( Incidence * ); | 413 | void processTodoListSelection( Incidence * ); |
414 | 414 | ||
415 | void processIncidenceSelection( Incidence * ); | 415 | void processIncidenceSelection( Incidence * ); |
416 | 416 | ||
417 | void purgeCompleted(); | 417 | void purgeCompleted(); |
418 | bool removeCompletedSubTodos( Todo* ); | 418 | bool removeCompletedSubTodos( Todo* ); |
419 | void slotCalendarChanged(); | 419 | void slotCalendarChanged(); |
420 | bool importBday(); | 420 | bool importBday(); |
421 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 421 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
422 | bool importQtopia( const QString &categoriesFile, | 422 | bool importQtopia( const QString &categoriesFile, |
423 | const QString &datebookFile, | 423 | const QString &datebookFile, |
424 | const QString &tasklistFile ); | 424 | const QString &tasklistFile ); |
425 | void syncSharp( ); | 425 | void syncSharp( ); |
426 | void slotSelectPickerDate( QDate ) ; | 426 | void slotSelectPickerDate( QDate ) ; |
427 | void showDatePicker( ) ; | 427 | void showDatePicker( ) ; |
428 | void moveIncidence(Incidence *) ; | 428 | void moveIncidence(Incidence *) ; |
429 | void beamIncidence(Incidence *) ; | 429 | void beamIncidence(Incidence *) ; |
430 | void beamCalendar() ; | 430 | void beamCalendar() ; |
431 | void beamFilteredCalendar() ; | 431 | void beamFilteredCalendar() ; |
432 | void beamIncidenceList(QPtrList<Incidence>) ; | 432 | void beamIncidenceList(QPtrList<Incidence>) ; |
433 | void manageCategories(); | 433 | void manageCategories(); |
434 | int addCategories(); | 434 | int addCategories(); |
435 | void removeCategories(); | 435 | void removeCategories(); |
436 | void setSyncDevice( QString ); | 436 | void setSyncDevice( QString ); |
437 | void setSyncName( QString ); | 437 | void setSyncName( QString ); |
438 | protected slots: | 438 | protected slots: |
439 | void timerAlarm(); | 439 | void timerAlarm(); |
440 | void suspendAlarm(); | 440 | void suspendAlarm(); |
441 | void beamDone( Ir *ir ); | 441 | void beamDone( Ir *ir ); |
442 | /** Select a view or adapt the current view to display the specified dates. */ | 442 | /** Select a view or adapt the current view to display the specified dates. */ |
443 | void showDates( const KCal::DateList & ); | 443 | void showDates( const KCal::DateList & ); |
444 | void selectWeekNum ( int ); | 444 | void selectWeekNum ( int ); |
445 | 445 | ||
446 | public: | 446 | public: |
447 | // show a standard warning | 447 | // show a standard warning |
448 | // returns KMsgBox::yesNoCancel() | 448 | // returns KMsgBox::yesNoCancel() |
449 | int msgCalModified(); | 449 | int msgCalModified(); |
450 | void confSync(); | 450 | void confSync(); |
451 | void setLoadedFileVersion(QDateTime); | 451 | void setLoadedFileVersion(QDateTime); |
452 | bool checkFileVersion(QString fn); | 452 | bool checkFileVersion(QString fn); |
453 | bool checkFileChanged(QString fn); | 453 | bool checkFileChanged(QString fn); |
454 | Event* getLastSyncEvent(); | 454 | Event* getLastSyncEvent(); |
455 | /** Adapt navigation units correpsonding to step size of navigation of the | 455 | /** Adapt navigation units correpsonding to step size of navigation of the |
456 | * current view. | 456 | * current view. |
457 | */ | 457 | */ |
458 | void adaptNavigationUnits(); | 458 | void adaptNavigationUnits(); |
459 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 459 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
460 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 460 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
461 | //Attendee* getYourAttendee(Event *event); | 461 | //Attendee* getYourAttendee(Event *event); |
462 | protected: | 462 | protected: |
463 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 463 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
464 | 464 | ||
465 | // returns KMsgBox::OKCandel() | 465 | // returns KMsgBox::OKCandel() |
466 | int msgItemDelete(); | 466 | int msgItemDelete(); |
467 | void showEventEditor(); | 467 | void showEventEditor(); |
468 | void showTodoEditor(); | 468 | void showTodoEditor(); |
469 | void writeLocale(); | 469 | void writeLocale(); |
470 | Todo *selectedTodo(); | 470 | Todo *selectedTodo(); |
471 | 471 | ||
472 | private: | 472 | private: |
473 | AlarmDialog * mAlarmDialog; | 473 | AlarmDialog * mAlarmDialog; |
474 | QString mAlarmNotification; | 474 | QString mAlarmNotification; |
475 | QString mSuspendAlarmNotification; | 475 | QString mSuspendAlarmNotification; |
476 | QTimer* mSuspendTimer; | 476 | QTimer* mSuspendTimer; |
477 | QTimer* mAlarmTimer; | 477 | QTimer* mAlarmTimer; |
478 | QTimer* mRecheckAlarmTimer; | 478 | QTimer* mRecheckAlarmTimer; |
479 | void computeAlarm( QString ); | 479 | void computeAlarm( QString ); |
480 | void startAlarm( QString, QString ); | 480 | void startAlarm( QString, QString ); |
481 | void setSyncEventsReadOnly(); | 481 | void setSyncEventsReadOnly(); |
482 | 482 | ||
483 | QDateTime loadedFileVersion; | 483 | QDateTime loadedFileVersion; |
484 | void checkSharpEvent( Event* lastSync, Incidence* toDelete ); | 484 | void checkSharpEvent( Event* lastSync, Incidence* toDelete ); |
485 | QPtrList<KSyncProfile> mSyncProfiles; | ||
486 | QStringList mSyncProfileNames; | ||
487 | void checkZaurusId( int id, bool todo = false ); | 485 | void checkZaurusId( int id, bool todo = false ); |
488 | int mGlobalSyncMode; | 486 | int mGlobalSyncMode; |
489 | QString mCurrentSyncDevice; | 487 | QString mCurrentSyncDevice; |
490 | QString mCurrentSyncName; | 488 | QString mCurrentSyncName; |
491 | KOBeamPrefs* beamDialog; | 489 | KOBeamPrefs* beamDialog; |
492 | void init(); | 490 | void init(); |
493 | int mDatePickerMode; | 491 | int mDatePickerMode; |
494 | bool mFlagEditDescription; | 492 | bool mFlagEditDescription; |
495 | QDateTime mLastCalendarSync; | 493 | QDateTime mLastCalendarSync; |
496 | void createPrinter(); | 494 | void createPrinter(); |
497 | 495 | ||
498 | void calendarModified( bool, Calendar * ); | 496 | void calendarModified( bool, Calendar * ); |
499 | 497 | ||
500 | CalPrinter *mCalPrinter; | 498 | CalPrinter *mCalPrinter; |
501 | 499 | ||
502 | QSplitter *mPanner; | 500 | QSplitter *mPanner; |
503 | QSplitter *mLeftSplitter; | 501 | QSplitter *mLeftSplitter; |
504 | QWidget *mLeftFrame; | 502 | QWidget *mLeftFrame; |
505 | QWidgetStack *mRightFrame; | 503 | QWidgetStack *mRightFrame; |
506 | 504 | ||
507 | KDatePicker* mDatePicker; | 505 | KDatePicker* mDatePicker; |
508 | QVBox* mDateFrame; | 506 | QVBox* mDateFrame; |
509 | NavigatorBar *mNavigatorBar; | 507 | NavigatorBar *mNavigatorBar; |
510 | 508 | ||
511 | KDateNavigator *mDateNavigator; // widget showing small month view. | 509 | KDateNavigator *mDateNavigator; // widget showing small month view. |
512 | 510 | ||
513 | KOFilterView *mFilterView; | 511 | KOFilterView *mFilterView; |
514 | 512 | ||
515 | ResourceView *mResourceView; | 513 | ResourceView *mResourceView; |
516 | 514 | ||
517 | // calendar object for this viewing instance | 515 | // calendar object for this viewing instance |
518 | Calendar *mCalendar; | 516 | Calendar *mCalendar; |
519 | 517 | ||
520 | CalendarResourceManager *mResourceManager; | 518 | CalendarResourceManager *mResourceManager; |
521 | 519 | ||
522 | FileStorage *mStorage; | 520 | FileStorage *mStorage; |
523 | 521 | ||
524 | DateNavigator *mNavigator; | 522 | DateNavigator *mNavigator; |
525 | 523 | ||
526 | KOViewManager *mViewManager; | 524 | KOViewManager *mViewManager; |
527 | KODialogManager *mDialogManager; | 525 | KODialogManager *mDialogManager; |
528 | 526 | ||
529 | // Calendar filters | 527 | // Calendar filters |
530 | QPtrList<CalFilter> mFilters; | 528 | QPtrList<CalFilter> mFilters; |
531 | 529 | ||
532 | // various housekeeping variables. | 530 | // various housekeeping variables. |
533 | bool mModified; // flag indicating if calendar is modified | 531 | bool mModified; // flag indicating if calendar is modified |
534 | bool mReadOnly; // flag indicating if calendar is read-only | 532 | bool mReadOnly; // flag indicating if calendar is read-only |
535 | QDate mSaveSingleDate; | 533 | QDate mSaveSingleDate; |
536 | 534 | ||
537 | Incidence *mSelectedIncidence; | 535 | Incidence *mSelectedIncidence; |
538 | Incidence *mMoveIncidence; | 536 | Incidence *mMoveIncidence; |
539 | 537 | ||
540 | KOTodoView *mTodoList; | 538 | KOTodoView *mTodoList; |
541 | KOEventEditor * mEventEditor; | 539 | KOEventEditor * mEventEditor; |
542 | KOTodoEditor * mTodoEditor; | 540 | KOTodoEditor * mTodoEditor; |
543 | KOEventViewerDialog * mEventViewerDialog; | 541 | KOEventViewerDialog * mEventViewerDialog; |
544 | void keyPressEvent ( QKeyEvent *e) ; | 542 | void keyPressEvent ( QKeyEvent *e) ; |
545 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 543 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
546 | }; | 544 | }; |
547 | 545 | ||
548 | 546 | ||
549 | class CalendarViewVisitor : public Incidence::Visitor | 547 | class CalendarViewVisitor : public Incidence::Visitor |
550 | { | 548 | { |
551 | public: | 549 | public: |
552 | CalendarViewVisitor() : mView( 0 ) {} | 550 | CalendarViewVisitor() : mView( 0 ) {} |
553 | 551 | ||
554 | bool act( Incidence *incidence, CalendarView *view ) | 552 | bool act( Incidence *incidence, CalendarView *view ) |
555 | { | 553 | { |
556 | mView = view; | 554 | mView = view; |
557 | return incidence->accept( *this ); | 555 | return incidence->accept( *this ); |
558 | } | 556 | } |
559 | 557 | ||
560 | protected: | 558 | protected: |
561 | CalendarView *mView; | 559 | CalendarView *mView; |
562 | }; | 560 | }; |
563 | 561 | ||
564 | class ShowIncidenceVisitor : public CalendarViewVisitor | 562 | class ShowIncidenceVisitor : public CalendarViewVisitor |
565 | { | 563 | { |
566 | protected: | 564 | protected: |
567 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 565 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
568 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 566 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
569 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 567 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
570 | }; | 568 | }; |
571 | 569 | ||
572 | class EditIncidenceVisitor : public CalendarViewVisitor | 570 | class EditIncidenceVisitor : public CalendarViewVisitor |
573 | { | 571 | { |
574 | protected: | 572 | protected: |
575 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 573 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
576 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 574 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
577 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 575 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
578 | }; | 576 | }; |
579 | 577 | ||
580 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 578 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
581 | { | 579 | { |
582 | protected: | 580 | protected: |
583 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 581 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
584 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 582 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
585 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 583 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
586 | }; | 584 | }; |
587 | 585 | ||
588 | #endif | 586 | #endif |
diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp index b7e4265..7c838f5 100644 --- a/korganizer/kosyncprefsdialog.cpp +++ b/korganizer/kosyncprefsdialog.cpp | |||
@@ -1,452 +1,468 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qdir.h> | ||
32 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
33 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
34 | #include <qvbox.h> | 35 | #include <qvbox.h> |
35 | #include <qhbox.h> | 36 | #include <qhbox.h> |
36 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
37 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
38 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
39 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
40 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
41 | #include <qstrlist.h> | 42 | #include <qstrlist.h> |
42 | #include <qapplication.h> | 43 | #include <qapplication.h> |
43 | 44 | ||
44 | #include <kcolorbutton.h> | 45 | #include <kcolorbutton.h> |
45 | #include <kdebug.h> | 46 | #include <kdebug.h> |
46 | #include <klocale.h> | 47 | #include <klocale.h> |
47 | #include <kglobal.h> | 48 | #include <kglobal.h> |
48 | #include <kfontdialog.h> | 49 | #include <kfontdialog.h> |
49 | #include <kmessagebox.h> | 50 | #include <kmessagebox.h> |
50 | #include <kcolordialog.h> | 51 | #include <kcolordialog.h> |
51 | #include <kiconloader.h> | 52 | #include <kiconloader.h> |
52 | #include <kemailsettings.h> | 53 | #include <kemailsettings.h> |
53 | #include <kstandarddirs.h> | 54 | #include <kstandarddirs.h> |
54 | #include <kfiledialog.h> | 55 | #include <kfiledialog.h> |
55 | #include <kmessagebox.h> | 56 | #include <kmessagebox.h> |
56 | 57 | ||
57 | #include <kurlrequester.h> | 58 | #include <kurlrequester.h> |
58 | #include <klineedit.h> | 59 | #include <klineedit.h> |
59 | #include <libkdepim/ksyncprofile.h> | 60 | #include <libkdepim/ksyncprofile.h> |
60 | 61 | ||
61 | 62 | ||
62 | #include "koprefs.h" | 63 | //#include "koprefs.h" |
63 | 64 | ||
64 | #include "kosyncprefsdialog.h" | 65 | #include "kosyncprefsdialog.h" |
65 | #include "koglobals.h" | 66 | //#include "koglobals.h" |
66 | 67 | ||
67 | 68 | ||
68 | KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | 69 | KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : |
69 | KDialog(parent,name,true) | 70 | KDialog(parent,name,true) |
70 | { | 71 | { |
71 | 72 | ||
72 | setCaption( i18n("Synchronization Preferences")); | 73 | setCaption( i18n("Synchronization Preferences")); |
73 | 74 | ||
74 | mSyncProfiles.setAutoDelete( true ); | 75 | mSyncProfiles.setAutoDelete( true ); |
75 | setupSyncAlgTab(); | 76 | setupSyncAlgTab(); |
76 | } | 77 | } |
77 | 78 | ||
78 | 79 | ||
79 | KOSyncPrefsDialog::~KOSyncPrefsDialog() | 80 | KOSyncPrefsDialog::~KOSyncPrefsDialog() |
80 | { | 81 | { |
81 | } | 82 | } |
82 | 83 | ||
83 | #include <qlayout.h> | 84 | #include <qlayout.h> |
84 | #include <qscrollview.h> | 85 | #include <qscrollview.h> |
85 | void KOSyncPrefsDialog::setupSyncAlgTab() | 86 | void KOSyncPrefsDialog::setupSyncAlgTab() |
86 | { | 87 | { |
87 | QLabel * lab; | 88 | QLabel * lab; |
88 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); | 89 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); |
89 | QVBox * mainbox = new QVBox( this ); | 90 | QVBox * mainbox = new QVBox( this ); |
90 | QScrollView* sv = new QScrollView( mainbox ); | 91 | QScrollView* sv = new QScrollView( mainbox ); |
91 | QHBoxLayout * lay = new QHBoxLayout( this ); | 92 | QHBoxLayout * lay = new QHBoxLayout( this ); |
92 | lay->addWidget( mainbox ); | 93 | lay->addWidget( mainbox ); |
93 | QHBox * b_box = new QHBox( mainbox ); | 94 | QHBox * b_box = new QHBox( mainbox ); |
94 | 95 | ||
95 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); | 96 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); |
96 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); | 97 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); |
97 | button = new QPushButton( i18n("Cancel"), b_box ); | 98 | button = new QPushButton( i18n("Cancel"), b_box ); |
98 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); | 99 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); |
99 | //QBoxLayout * sl = new QVBoxLayout(this ); | 100 | //QBoxLayout * sl = new QVBoxLayout(this ); |
100 | //sl->addWidget ( sv ); | 101 | //sl->addWidget ( sv ); |
101 | sv->setResizePolicy ( QScrollView::AutoOneFit ); | 102 | sv->setResizePolicy ( QScrollView::AutoOneFit ); |
102 | QFrame *topFrame = new QFrame ( sv ); | 103 | QFrame *topFrame = new QFrame ( sv ); |
103 | sv->addChild( topFrame ); | 104 | sv->addChild( topFrame ); |
104 | mSetupSyncAlgTab = topFrame; | 105 | mSetupSyncAlgTab = topFrame; |
105 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 106 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
106 | topLayout->setSpacing(spacingHint()); | 107 | topLayout->setSpacing(spacingHint()); |
107 | topLayout->setMargin(marginHint()); | 108 | topLayout->setMargin(marginHint()); |
108 | 109 | ||
109 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); | 110 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); |
110 | int iii = 0; | 111 | int iii = 0; |
111 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 112 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
112 | //++iii; | 113 | //++iii; |
113 | 114 | ||
114 | mMyMachineName = new QLineEdit(topFrame); | 115 | mMyMachineName = new QLineEdit(topFrame); |
115 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); | 116 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); |
116 | topLayout->addWidget(lab ,iii,0); | 117 | topLayout->addWidget(lab ,iii,0); |
117 | topLayout->addWidget(mMyMachineName,iii,1); | 118 | topLayout->addWidget(mMyMachineName,iii,1); |
118 | ++iii; | 119 | ++iii; |
119 | 120 | ||
120 | QHBox* buttonbox = new QHBox( topFrame); | 121 | QHBox* buttonbox = new QHBox( topFrame); |
121 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | 122 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); |
122 | ++iii; | 123 | ++iii; |
123 | button = new QPushButton( i18n("New profile"), buttonbox ); | 124 | button = new QPushButton( i18n("New profile"), buttonbox ); |
124 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | 125 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); |
125 | 126 | ||
126 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | 127 | button = new QPushButton( i18n("Clone profile"), buttonbox ); |
127 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | 128 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); |
128 | 129 | ||
129 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | 130 | button = new QPushButton( i18n("Delete profile"), buttonbox ); |
130 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | 131 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); |
131 | 132 | ||
132 | mProfileBox = new QComboBox(topFrame); | 133 | mProfileBox = new QComboBox(topFrame); |
133 | mProfileBox->setEditable ( true ); | 134 | mProfileBox->setEditable ( true ); |
134 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 135 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
135 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 136 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
136 | 137 | ||
137 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 138 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
138 | topLayout->addWidget(lab ,iii,0); | 139 | topLayout->addWidget(lab ,iii,0); |
139 | topLayout->addWidget(mProfileBox, iii,1); | 140 | topLayout->addWidget(mProfileBox, iii,1); |
140 | ++iii; | 141 | ++iii; |
141 | 142 | ||
142 | mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame ); | 143 | mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame ); |
143 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); | 144 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); |
144 | ++iii; | 145 | ++iii; |
145 | 146 | ||
146 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 147 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
147 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 148 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
148 | ++iii; | 149 | ++iii; |
149 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 150 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
150 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 151 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
151 | ++iii; | 152 | ++iii; |
152 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 153 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
153 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 154 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
154 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 155 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
155 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 156 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
156 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 157 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
157 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 158 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
158 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 159 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
159 | 160 | ||
160 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 161 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
161 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 162 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
162 | ++iii; | 163 | ++iii; |
163 | 164 | ||
164 | mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); | 165 | mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); |
165 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 166 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
166 | ++iii; | 167 | ++iii; |
167 | 168 | ||
168 | mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); | 169 | mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); |
169 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 170 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); |
170 | ++iii; | 171 | ++iii; |
171 | 172 | ||
172 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 173 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
173 | gr = proGr; | 174 | gr = proGr; |
174 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 175 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
175 | ++iii; | 176 | ++iii; |
176 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 177 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
177 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 178 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
178 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 179 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
179 | 180 | ||
180 | localFileWidget = new QVBox( topFrame); | 181 | localFileWidget = new QVBox( topFrame); |
181 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | 182 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); |
182 | ++iii; | 183 | ++iii; |
183 | QHBox* temphb = new QHBox( localFileWidget ); | 184 | QHBox* temphb = new QHBox( localFileWidget ); |
184 | lab = new QLabel( i18n("Local file:"), temphb); | 185 | lab = new QLabel( i18n("Local file:"), temphb); |
185 | mRemoteFile = new QLineEdit(localFileWidget); | 186 | mRemoteFile = new QLineEdit(localFileWidget); |
186 | 187 | ||
187 | button = new QPushButton( i18n("Choose..."), temphb ); | 188 | button = new QPushButton( i18n("Choose..."), temphb ); |
188 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | 189 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); |
189 | 190 | ||
190 | 191 | ||
191 | remoteFileWidget = new QVBox( topFrame); | 192 | remoteFileWidget = new QVBox( topFrame); |
192 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | 193 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); |
193 | ++iii; | 194 | ++iii; |
194 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | 195 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); |
195 | mRemotePrecommand = new QLineEdit(remoteFileWidget); | 196 | mRemotePrecommand = new QLineEdit(remoteFileWidget); |
196 | 197 | ||
197 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | 198 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); |
198 | mLocalTempFile = new QLineEdit(remoteFileWidget); | 199 | mLocalTempFile = new QLineEdit(remoteFileWidget); |
199 | 200 | ||
200 | 201 | ||
201 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); | 202 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); |
202 | mRemotePostcommand = new QLineEdit(remoteFileWidget); | 203 | mRemotePostcommand = new QLineEdit(remoteFileWidget); |
203 | 204 | ||
204 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); | 205 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); |
205 | temphb = new QHBox( remoteFileWidget ); | 206 | temphb = new QHBox( remoteFileWidget ); |
206 | button = new QPushButton( i18n("ssh/scp"), temphb ); | 207 | button = new QPushButton( i18n("ssh/scp"), temphb ); |
207 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | 208 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); |
208 | button = new QPushButton( i18n("ftp"), temphb ); | 209 | button = new QPushButton( i18n("ftp"), temphb ); |
209 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | 210 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); |
210 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | 211 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); |
211 | 212 | ||
212 | 213 | ||
213 | } | 214 | } |
214 | void KOSyncPrefsDialog::slotOK() | 215 | void KOSyncPrefsDialog::slotOK() |
215 | { | 216 | { |
216 | if ( mMyMachineName->text() == "undefined" ) { | 217 | if ( mMyMachineName->text() == "undefined" ) { |
217 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 218 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
218 | return; | 219 | return; |
219 | } | 220 | } |
220 | int i; | 221 | int i; |
221 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 222 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
222 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 223 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { |
223 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 224 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
224 | return; | 225 | return; |
225 | } | 226 | } |
226 | } | 227 | } |
227 | usrWriteConfig(); | 228 | usrWriteConfig(); |
228 | QDialog::accept(); | 229 | QDialog::accept(); |
229 | } | 230 | } |
230 | void KOSyncPrefsDialog::accept() | 231 | void KOSyncPrefsDialog::accept() |
231 | { | 232 | { |
232 | slotOK(); | 233 | slotOK(); |
233 | } | 234 | } |
234 | void KOSyncPrefsDialog::chooseFile() | 235 | void KOSyncPrefsDialog::chooseFile() |
235 | { | 236 | { |
236 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 237 | QString fn = QDir::homeDirPath(); |
237 | 238 | ||
238 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 239 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
239 | if ( fn == "" ) | 240 | if ( fn == "" ) |
240 | return; | 241 | return; |
241 | mRemoteFile->setText( fn ); | 242 | mRemoteFile->setText( fn ); |
242 | } | 243 | } |
243 | 244 | ||
244 | void KOSyncPrefsDialog::textChanged( const QString & s ) | 245 | void KOSyncPrefsDialog::textChanged( const QString & s ) |
245 | { | 246 | { |
246 | if ( mProfileBox->count() == 0 ) | 247 | if ( mProfileBox->count() == 0 ) |
247 | return; | 248 | return; |
248 | if ( currentSelection < 3 ) { | 249 | if ( currentSelection < 3 ) { |
249 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 250 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
250 | mProfileBox->blockSignals( true ); | 251 | mProfileBox->blockSignals( true ); |
251 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 252 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
252 | mProfileBox->blockSignals( false ); | 253 | mProfileBox->blockSignals( false ); |
253 | return; | 254 | return; |
254 | } | 255 | } |
255 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 256 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
256 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 257 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
257 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 258 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
258 | prof->setName( s ); | 259 | prof->setName( s ); |
259 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 260 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
260 | } | 261 | } |
261 | void KOSyncPrefsDialog::profileChanged( int item ) | 262 | void KOSyncPrefsDialog::profileChanged( int item ) |
262 | { | 263 | { |
263 | //qDebug("KOSyncPrefsDialog::profileChanged %d ", item ); | 264 | //qDebug("KOSyncPrefsDialog::profileChanged %d ", item ); |
264 | KSyncProfile* prof; | 265 | KSyncProfile* prof; |
265 | saveProfile(); | 266 | saveProfile(); |
266 | currentSelection = item; | 267 | currentSelection = item; |
267 | prof = mSyncProfiles.at(item) ; | 268 | prof = mSyncProfiles.at(item) ; |
268 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | 269 | mRemotePrecommand->setText(prof->getPreSyncCommand()); |
269 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | 270 | mRemotePostcommand->setText(prof->getPostSyncCommand()); |
270 | mLocalTempFile->setText(prof->getLocalTempFile()); | 271 | mLocalTempFile->setText(prof->getLocalTempFile()); |
271 | mRemoteFile->setText(prof->getRemoteFileName()) ; | 272 | mRemoteFile->setText(prof->getRemoteFileName()) ; |
272 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | 273 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); |
273 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | 274 | mAskForPreferences->setChecked( prof->getAskForPreferences()); |
274 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 275 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
275 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 276 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
276 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 277 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
277 | 278 | ||
278 | switch ( prof->getSyncPrefs() ) { | 279 | switch ( prof->getSyncPrefs() ) { |
279 | case 0: | 280 | case 0: |
280 | loc->setChecked( true); | 281 | loc->setChecked( true); |
281 | break; | 282 | break; |
282 | case 1: | 283 | case 1: |
283 | rem->setChecked( true ); | 284 | rem->setChecked( true ); |
284 | break; | 285 | break; |
285 | case 2: | 286 | case 2: |
286 | newest->setChecked( true); | 287 | newest->setChecked( true); |
287 | break; | 288 | break; |
288 | case 3: | 289 | case 3: |
289 | ask->setChecked( true); | 290 | ask->setChecked( true); |
290 | break; | 291 | break; |
291 | case 4: | 292 | case 4: |
292 | f_loc->setChecked( true); | 293 | f_loc->setChecked( true); |
293 | break; | 294 | break; |
294 | case 5: | 295 | case 5: |
295 | f_rem->setChecked( true); | 296 | f_rem->setChecked( true); |
296 | break; | 297 | break; |
297 | case 6: | 298 | case 6: |
298 | //both->setChecked( true); | 299 | //both->setChecked( true); |
299 | break; | 300 | break; |
300 | default: | 301 | default: |
301 | break; | 302 | break; |
302 | } | 303 | } |
303 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 304 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
304 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); | 305 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); |
305 | proGr->setEnabled( item > 2 ); | 306 | proGr->setEnabled( item > 2 ); |
306 | if ( item < 3 ) { | 307 | if ( item < 3 ) { |
307 | localFileWidget->setEnabled(false); | 308 | localFileWidget->setEnabled(false); |
308 | remoteFileWidget->setEnabled(false); | 309 | remoteFileWidget->setEnabled(false); |
309 | 310 | ||
310 | } else | 311 | } else |
311 | kindChanged( prof->getIsLocalFileSync() ); | 312 | kindChanged( prof->getIsLocalFileSync() ); |
312 | } | 313 | } |
313 | 314 | ||
314 | void KOSyncPrefsDialog::fillSSH() | 315 | void KOSyncPrefsDialog::fillSSH() |
315 | { | 316 | { |
316 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 317 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
317 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 318 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
318 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | 319 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); |
319 | } | 320 | } |
320 | void KOSyncPrefsDialog::fillFTP() | 321 | void KOSyncPrefsDialog::fillFTP() |
321 | { | 322 | { |
322 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | 323 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); |
323 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 324 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
324 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 325 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
325 | 326 | ||
326 | } | 327 | } |
327 | void KOSyncPrefsDialog::kindChanged( bool b ) | 328 | void KOSyncPrefsDialog::kindChanged( bool b ) |
328 | { | 329 | { |
329 | 330 | ||
330 | localFileWidget->setEnabled(b); | 331 | localFileWidget->setEnabled(b); |
331 | remoteFileWidget->setEnabled(!b); | 332 | remoteFileWidget->setEnabled(!b); |
332 | 333 | ||
333 | } | 334 | } |
334 | void KOSyncPrefsDialog::deleteProfile() | 335 | void KOSyncPrefsDialog::deleteProfile() |
335 | { | 336 | { |
336 | //qDebug("KOSyncPrefsDialog::deleteProfile() "); | 337 | //qDebug("KOSyncPrefsDialog::deleteProfile() "); |
337 | if ( currentSelection >= 0 ) { | 338 | if ( currentSelection >= 0 ) { |
338 | if ( currentSelection < 3 ) { | 339 | if ( currentSelection < 3 ) { |
339 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); | 340 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); |
340 | return; | 341 | return; |
341 | } | 342 | } |
342 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); | 343 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); |
343 | mSyncProfiles.remove( temp ); | 344 | mSyncProfiles.remove( temp ); |
344 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); | 345 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); |
345 | insertProfiles(); | 346 | insertProfiles(); |
346 | } | 347 | } |
347 | } | 348 | } |
348 | 349 | ||
349 | void KOSyncPrefsDialog::saveProfile() | 350 | void KOSyncPrefsDialog::saveProfile() |
350 | { | 351 | { |
351 | KSyncProfile* prof; | 352 | KSyncProfile* prof; |
352 | if ( currentSelection >= 0 ) { | 353 | if ( currentSelection >= 0 ) { |
353 | prof = mSyncProfiles.at(currentSelection) ; | 354 | prof = mSyncProfiles.at(currentSelection) ; |
354 | prof->setPreSyncCommand( mRemotePrecommand->text()); | 355 | prof->setPreSyncCommand( mRemotePrecommand->text()); |
355 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | 356 | prof->setPostSyncCommand( mRemotePostcommand->text() ); |
356 | prof->setLocalTempFile( mLocalTempFile->text()); | 357 | prof->setLocalTempFile( mLocalTempFile->text()); |
357 | prof->setRemoteFileName( mRemoteFile->text() ); | 358 | prof->setRemoteFileName( mRemoteFile->text() ); |
358 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | 359 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); |
359 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | 360 | prof->setAskForPreferences( mAskForPreferences->isChecked()); |
360 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | 361 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); |
361 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | 362 | prof->setWriteBackFile( mWriteBackFile->isChecked()); |
362 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | 363 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); |
363 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 364 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
364 | prof->setSyncPrefs( syncprefs); | 365 | prof->setSyncPrefs( syncprefs); |
365 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 366 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
366 | } | 367 | } |
367 | 368 | ||
368 | } | 369 | } |
369 | 370 | ||
370 | void KOSyncPrefsDialog::insertProfiles() | 371 | void KOSyncPrefsDialog::insertProfiles() |
371 | { | 372 | { |
372 | int curItem = mProfileBox->currentItem(); | 373 | int curItem = mProfileBox->currentItem(); |
373 | mProfileBox->blockSignals( true ); | 374 | mProfileBox->blockSignals( true ); |
374 | mProfileBox->clear(); | 375 | mProfileBox->clear(); |
375 | mProfileBox->insertStringList (mSyncProfileNames ); | 376 | mProfileBox->insertStringList (mSyncProfileNames ); |
376 | int item = mSyncProfileNames.count() -1; | 377 | int item = mSyncProfileNames.count() -1; |
377 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | 378 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) |
378 | mProfileBox->setCurrentItem( curItem ); | 379 | mProfileBox->setCurrentItem( curItem ); |
379 | else if ( item >= 0 ) { | 380 | else if ( item >= 0 ) { |
380 | mProfileBox->setCurrentItem( item ); | 381 | mProfileBox->setCurrentItem( item ); |
381 | } | 382 | } |
382 | currentSelection = -1; | 383 | currentSelection = -1; |
383 | if ( mSyncProfileNames.count() > 0 ) { | 384 | if ( mSyncProfileNames.count() > 0 ) { |
384 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | 385 | //qDebug(" profileChanged( mProfileBox->currentItem() "); |
385 | profileChanged( mProfileBox->currentItem() ); | 386 | profileChanged( mProfileBox->currentItem() ); |
386 | currentSelection = mProfileBox->currentItem(); | 387 | currentSelection = mProfileBox->currentItem(); |
387 | } | 388 | } |
388 | mProfileBox->blockSignals( false ); | 389 | mProfileBox->blockSignals( false ); |
389 | } | 390 | } |
390 | 391 | ||
391 | void KOSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | 392 | void KOSyncPrefsDialog::addProfile ( KSyncProfile* temp ) |
392 | { | 393 | { |
393 | saveProfile(); | 394 | saveProfile(); |
394 | mSyncProfiles.append( temp ); | 395 | mSyncProfiles.append( temp ); |
395 | mSyncProfileNames << temp->getName(); | 396 | mSyncProfileNames << temp->getName(); |
396 | insertProfiles(); | 397 | insertProfiles(); |
397 | int last = mProfileBox->count() -1; | 398 | int last = mProfileBox->count() -1; |
398 | mProfileBox->blockSignals( true ); | 399 | mProfileBox->blockSignals( true ); |
399 | mProfileBox->setCurrentItem( last ); | 400 | mProfileBox->setCurrentItem( last ); |
400 | mProfileBox->blockSignals( false ); | 401 | mProfileBox->blockSignals( false ); |
401 | profileChanged(last); | 402 | profileChanged(last); |
402 | } | 403 | } |
403 | void KOSyncPrefsDialog::newProfile() | 404 | void KOSyncPrefsDialog::newProfile() |
404 | { | 405 | { |
405 | addProfile ( new KSyncProfile () ); | 406 | addProfile ( new KSyncProfile () ); |
406 | } | 407 | } |
407 | 408 | ||
408 | void KOSyncPrefsDialog::cloneProfile() | 409 | void KOSyncPrefsDialog::cloneProfile() |
409 | { | 410 | { |
410 | if ( currentSelection >= 0 ) | 411 | if ( currentSelection >= 0 ) |
411 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; | 412 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; |
412 | else | 413 | else |
413 | newProfile(); | 414 | newProfile(); |
414 | } | 415 | } |
415 | 416 | ||
417 | void KOSyncPrefsDialog::setLocalMachineName ( const QString& name ) | ||
418 | { | ||
419 | mMyMachineName->setText( name ); | ||
416 | 420 | ||
421 | } | ||
422 | QString KOSyncPrefsDialog::getLocalMachineName ( ) | ||
423 | { | ||
424 | return mMyMachineName->text(); | ||
425 | } | ||
426 | |||
427 | QStringList KOSyncPrefsDialog::getSyncProfileNames() | ||
428 | { | ||
429 | return mSyncProfileNames; | ||
430 | } | ||
417 | void KOSyncPrefsDialog::usrReadConfig() | 431 | void KOSyncPrefsDialog::usrReadConfig() |
418 | { | 432 | { |
419 | KConfig *config = KOGlobals::config(); | 433 | //KConfig *config = KOGlobals::config(); |
420 | config->setGroup("SyncProfiles"); | 434 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
421 | mSyncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 435 | config.setGroup("SyncProfiles"); |
436 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); | ||
422 | int i; | 437 | int i; |
423 | KSyncProfile* temp ; | 438 | KSyncProfile* temp ; |
424 | mSyncProfiles.clear(); | 439 | mSyncProfiles.clear(); |
425 | for ( i = 0; i < mSyncProfileNames.count();++i ) { | 440 | for ( i = 0; i < mSyncProfileNames.count();++i ) { |
426 | temp = new KSyncProfile (); | 441 | temp = new KSyncProfile (); |
427 | temp->setName( mSyncProfileNames[i] ); | 442 | temp->setName( mSyncProfileNames[i] ); |
428 | temp->readConfig( config ); | 443 | temp->readConfig( &config ); |
429 | mSyncProfiles.append( temp ); | 444 | mSyncProfiles.append( temp ); |
430 | } | 445 | } |
431 | insertProfiles(); | 446 | insertProfiles(); |
432 | mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); | 447 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); |
433 | } | 448 | } |
434 | 449 | ||
435 | 450 | ||
436 | void KOSyncPrefsDialog::usrWriteConfig() | 451 | void KOSyncPrefsDialog::usrWriteConfig() |
437 | { | 452 | { |
438 | saveProfile(); | 453 | saveProfile(); |
439 | if ( currentSelection >= 0 ) | 454 | if ( currentSelection >= 0 ) |
440 | profileChanged(currentSelection); | 455 | profileChanged(currentSelection); |
441 | KConfig *config = KOGlobals::config(); | 456 | //KConfig *config = KOGlobals::config(); |
442 | config->setGroup("SyncProfiles"); | 457 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
458 | config.setGroup("SyncProfiles"); | ||
443 | KSyncProfile* prof = mSyncProfiles.first(); | 459 | KSyncProfile* prof = mSyncProfiles.first(); |
444 | while ( prof ) { | 460 | while ( prof ) { |
445 | prof->writeConfig(config); | 461 | prof->writeConfig(&config); |
446 | prof = mSyncProfiles.next(); | 462 | prof = mSyncProfiles.next(); |
447 | } | 463 | } |
448 | KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; | 464 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; |
449 | KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); | 465 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); |
450 | config->writeEntry("SyncProfileNames",&mSyncProfileNames); | 466 | config.writeEntry("SyncProfileNames",&mSyncProfileNames); |
451 | } | 467 | } |
452 | 468 | ||
diff --git a/korganizer/kosyncprefsdialog.h b/korganizer/kosyncprefsdialog.h index d2d8c6f..541d18b 100644 --- a/korganizer/kosyncprefsdialog.h +++ b/korganizer/kosyncprefsdialog.h | |||
@@ -1,109 +1,113 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOPREFSDIALOG_H | 23 | #ifndef _KOPREFSDIALOG_H |
24 | #define _KOPREFSDIALOG_H | 24 | #define _KOPREFSDIALOG_H |
25 | 25 | ||
26 | //#include <qframe.h> | 26 | //#include <qframe.h> |
27 | //#include <qdict.h> | 27 | //#include <qdict.h> |
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | //#include <qcolor.h> | 30 | //#include <qcolor.h> |
31 | //#include <qlistview.h> | 31 | //#include <qlistview.h> |
32 | 32 | ||
33 | #include <kdialogbase.h> | 33 | #include <kdialogbase.h> |
34 | 34 | ||
35 | #include <libkdepim/kprefsdialog.h> | 35 | #include <libkdepim/kprefsdialog.h> |
36 | 36 | ||
37 | class KColorButton; | 37 | class KColorButton; |
38 | class QSpinBox;; | 38 | class QSpinBox;; |
39 | class QRadioButton; | 39 | class QRadioButton; |
40 | class QCheckBox; | 40 | class QCheckBox; |
41 | class QSlider; | 41 | class QSlider; |
42 | class KURLRequester; | 42 | class KURLRequester; |
43 | class QComboBox; | 43 | class QComboBox; |
44 | class QLineEdit; | 44 | class QLineEdit; |
45 | class QStringList; | 45 | class QStringList; |
46 | class KSyncProfile; | 46 | class KSyncProfile; |
47 | 47 | ||
48 | /** Dialog to change the korganizer configuration. | 48 | /** Dialog to change the korganizer configuration. |
49 | */ | 49 | */ |
50 | class KOSyncPrefsDialog : public KDialog | 50 | class KOSyncPrefsDialog : public KDialog |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | public: | 53 | public: |
54 | /** Initialize dialog and pages */ | 54 | /** Initialize dialog and pages */ |
55 | KOSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | 55 | KOSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); |
56 | ~KOSyncPrefsDialog(); | 56 | ~KOSyncPrefsDialog(); |
57 | void usrReadConfig(); | 57 | void usrReadConfig(); |
58 | void setLocalMachineName ( const QString& name ); | ||
59 | QString getLocalMachineName ( ); | ||
60 | |||
61 | QStringList getSyncProfileNames(); | ||
58 | 62 | ||
59 | public slots: | 63 | public slots: |
60 | protected slots: | 64 | protected slots: |
61 | void accept(); | 65 | void accept(); |
62 | void deleteProfile(); | 66 | void deleteProfile(); |
63 | void newProfile(); | 67 | void newProfile(); |
64 | void cloneProfile(); | 68 | void cloneProfile(); |
65 | void kindChanged(bool); | 69 | void kindChanged(bool); |
66 | void fillSSH(); | 70 | void fillSSH(); |
67 | void fillFTP(); | 71 | void fillFTP(); |
68 | void textChanged( const QString & ); | 72 | void textChanged( const QString & ); |
69 | void profileChanged( int ); | 73 | void profileChanged( int ); |
70 | void chooseFile(); | 74 | void chooseFile(); |
71 | void slotOK(); | 75 | void slotOK(); |
72 | 76 | ||
73 | protected: | 77 | protected: |
74 | void usrWriteConfig(); | 78 | void usrWriteConfig(); |
75 | 79 | ||
76 | void setupSyncAlgTab(); | 80 | void setupSyncAlgTab(); |
77 | 81 | ||
78 | private: | 82 | private: |
79 | int currentSelection; | 83 | int currentSelection; |
80 | QPtrList<KSyncProfile> mSyncProfiles; | 84 | QPtrList<KSyncProfile> mSyncProfiles; |
81 | QStringList mSyncProfileNames; | 85 | QStringList mSyncProfileNames; |
82 | QLineEdit * mMyMachineName; | 86 | QLineEdit * mMyMachineName; |
83 | QComboBox * mProfileBox; | 87 | QComboBox * mProfileBox; |
84 | QRadioButton* mIsLocal; | 88 | QRadioButton* mIsLocal; |
85 | QRadioButton* mIsNotLocal; | 89 | QRadioButton* mIsNotLocal; |
86 | QCheckBox* mIncludeInRing; | 90 | QCheckBox* mIncludeInRing; |
87 | void addProfile ( KSyncProfile* ); | 91 | void addProfile ( KSyncProfile* ); |
88 | void insertProfiles(); | 92 | void insertProfiles(); |
89 | void saveProfile(); | 93 | void saveProfile(); |
90 | QButtonGroup* proGr; | 94 | QButtonGroup* proGr; |
91 | 95 | ||
92 | QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; | 96 | QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; |
93 | 97 | ||
94 | 98 | ||
95 | QLineEdit * mRemotePostcommand; | 99 | QLineEdit * mRemotePostcommand; |
96 | QLineEdit * mRemotePrecommand; | 100 | QLineEdit * mRemotePrecommand; |
97 | QLineEdit * mRemoteFile; | 101 | QLineEdit * mRemoteFile; |
98 | QLineEdit * mLocalTempFile; | 102 | QLineEdit * mLocalTempFile; |
99 | QWidget* mSetupSyncAlgTab; | 103 | QWidget* mSetupSyncAlgTab; |
100 | 104 | ||
101 | QVBox* localFileWidget; | 105 | QVBox* localFileWidget; |
102 | QVBox* remoteFileWidget; | 106 | QVBox* remoteFileWidget; |
103 | QCheckBox* mWriteBackFile; | 107 | QCheckBox* mWriteBackFile; |
104 | QCheckBox* mWriteBackExisting; | 108 | QCheckBox* mWriteBackExisting; |
105 | QCheckBox* mAskForPreferences; | 109 | QCheckBox* mAskForPreferences; |
106 | QCheckBox* mShowSummaryAfterSync; | 110 | QCheckBox* mShowSummaryAfterSync; |
107 | }; | 111 | }; |
108 | 112 | ||
109 | #endif | 113 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a487f14..589ab2d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -629,405 +629,404 @@ void MainWindow::initActions() | |||
629 | #else | 629 | #else |
630 | importMenu->insertSeparator(); | 630 | importMenu->insertSeparator(); |
631 | icon = loadPixmap( pathString + "print" ); | 631 | icon = loadPixmap( pathString + "print" ); |
632 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 632 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
633 | action->addTo( importMenu ); | 633 | action->addTo( importMenu ); |
634 | connect( action, SIGNAL( activated() ), | 634 | connect( action, SIGNAL( activated() ), |
635 | this, SLOT( printCal() ) ); | 635 | this, SLOT( printCal() ) ); |
636 | 636 | ||
637 | icon = loadPixmap( pathString + "print" ); | 637 | icon = loadPixmap( pathString + "print" ); |
638 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 638 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
639 | action->addTo( importMenu ); | 639 | action->addTo( importMenu ); |
640 | connect( action, SIGNAL( activated() ), | 640 | connect( action, SIGNAL( activated() ), |
641 | this, SLOT( printSel() ) ); | 641 | this, SLOT( printSel() ) ); |
642 | #endif | 642 | #endif |
643 | importMenu->insertSeparator(); | 643 | importMenu->insertSeparator(); |
644 | action = new QAction( "beam all", i18n("Save"), 0, | 644 | action = new QAction( "beam all", i18n("Save"), 0, |
645 | this ); | 645 | this ); |
646 | action->addTo( importMenu ); | 646 | action->addTo( importMenu ); |
647 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 647 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
648 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 648 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
649 | this ); | 649 | this ); |
650 | action->addTo( importMenu ); | 650 | action->addTo( importMenu ); |
651 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 651 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
652 | 652 | ||
653 | //menuBar->insertItem( "Configure",configureMenu ); | 653 | //menuBar->insertItem( "Configure",configureMenu ); |
654 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 654 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
655 | icon = loadPixmap( "korganizer/korganizer" ); | 655 | icon = loadPixmap( "korganizer/korganizer" ); |
656 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 656 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
657 | action->addTo( helpMenu ); | 657 | action->addTo( helpMenu ); |
658 | connect( action, SIGNAL( activated() ), | 658 | connect( action, SIGNAL( activated() ), |
659 | SLOT( keyBindings() ) ); | 659 | SLOT( keyBindings() ) ); |
660 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 660 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
661 | action->addTo( helpMenu ); | 661 | action->addTo( helpMenu ); |
662 | connect( action, SIGNAL( activated() ), | 662 | connect( action, SIGNAL( activated() ), |
663 | SLOT( features() ) ); | 663 | SLOT( features() ) ); |
664 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 664 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
665 | action->addTo( helpMenu ); | 665 | action->addTo( helpMenu ); |
666 | connect( action, SIGNAL( activated() ), | 666 | connect( action, SIGNAL( activated() ), |
667 | SLOT( aboutAutoSaving() ) ); | 667 | SLOT( aboutAutoSaving() ) ); |
668 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 668 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
669 | action->addTo( helpMenu ); | 669 | action->addTo( helpMenu ); |
670 | connect( action, SIGNAL( activated() ), | 670 | connect( action, SIGNAL( activated() ), |
671 | SLOT( aboutKnownBugs() ) ); | 671 | SLOT( aboutKnownBugs() ) ); |
672 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 672 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
673 | action->addTo( helpMenu ); | 673 | action->addTo( helpMenu ); |
674 | connect( action, SIGNAL( activated() ), | 674 | connect( action, SIGNAL( activated() ), |
675 | SLOT( usertrans() ) ); | 675 | SLOT( usertrans() ) ); |
676 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 676 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
677 | action->addTo( helpMenu ); | 677 | action->addTo( helpMenu ); |
678 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
679 | SLOT( synchowto() ) ); | 679 | SLOT( synchowto() ) ); |
680 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 680 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
681 | action->addTo( helpMenu ); | 681 | action->addTo( helpMenu ); |
682 | connect( action, SIGNAL( activated() ), | 682 | connect( action, SIGNAL( activated() ), |
683 | SLOT( whatsNew() ) ); | 683 | SLOT( whatsNew() ) ); |
684 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 684 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
685 | action->addTo( helpMenu ); | 685 | action->addTo( helpMenu ); |
686 | connect( action, SIGNAL( activated() ), | 686 | connect( action, SIGNAL( activated() ), |
687 | SLOT( faq() ) ); | 687 | SLOT( faq() ) ); |
688 | 688 | ||
689 | 689 | ||
690 | action = new QAction( "about", i18n("About..."), 0, this ); | 690 | action = new QAction( "about", i18n("About..."), 0, this ); |
691 | action->addTo( helpMenu ); | 691 | action->addTo( helpMenu ); |
692 | connect( action, SIGNAL( activated() ), | 692 | connect( action, SIGNAL( activated() ), |
693 | SLOT( about() ) ); | 693 | SLOT( about() ) ); |
694 | //menuBar->insertSeparator(); | 694 | //menuBar->insertSeparator(); |
695 | 695 | ||
696 | // ****************************************************** | 696 | // ****************************************************** |
697 | // menubar icons | 697 | // menubar icons |
698 | 698 | ||
699 | 699 | ||
700 | iconToolBar->setHorizontalStretchable (true ); | 700 | iconToolBar->setHorizontalStretchable (true ); |
701 | //menuBar->insertItem( iconToolBar ); | 701 | //menuBar->insertItem( iconToolBar ); |
702 | //xdays_action | 702 | //xdays_action |
703 | if (p-> mShowIconNewEvent) | 703 | if (p-> mShowIconNewEvent) |
704 | ne_action->addTo( iconToolBar ); | 704 | ne_action->addTo( iconToolBar ); |
705 | if (p->mShowIconNewTodo ) | 705 | if (p->mShowIconNewTodo ) |
706 | nt_action->addTo( iconToolBar ); | 706 | nt_action->addTo( iconToolBar ); |
707 | if (p-> mShowIconSearch) | 707 | if (p-> mShowIconSearch) |
708 | search_action->addTo( iconToolBar ); | 708 | search_action->addTo( iconToolBar ); |
709 | if (p-> mShowIconNext) | 709 | if (p-> mShowIconNext) |
710 | whatsnext_action->addTo( iconToolBar ); | 710 | whatsnext_action->addTo( iconToolBar ); |
711 | if (p-> mShowIconNextDays) | 711 | if (p-> mShowIconNextDays) |
712 | xdays_action->addTo( iconToolBar ); | 712 | xdays_action->addTo( iconToolBar ); |
713 | if (p-> mShowIconList) | 713 | if (p-> mShowIconList) |
714 | showlist_action->addTo( iconToolBar ); | 714 | showlist_action->addTo( iconToolBar ); |
715 | if (p-> mShowIconDay1) | 715 | if (p-> mShowIconDay1) |
716 | day1_action->addTo( iconToolBar ); | 716 | day1_action->addTo( iconToolBar ); |
717 | if (p-> mShowIconDay5) | 717 | if (p-> mShowIconDay5) |
718 | day5_action->addTo( iconToolBar ); | 718 | day5_action->addTo( iconToolBar ); |
719 | if (p-> mShowIconDay7) | 719 | if (p-> mShowIconDay7) |
720 | day7_action->addTo( iconToolBar ); | 720 | day7_action->addTo( iconToolBar ); |
721 | if (p-> mShowIconMonth) | 721 | if (p-> mShowIconMonth) |
722 | month_action->addTo( iconToolBar ); | 722 | month_action->addTo( iconToolBar ); |
723 | if (p-> mShowIconTodoview) | 723 | if (p-> mShowIconTodoview) |
724 | todoview_action->addTo( iconToolBar ); | 724 | todoview_action->addTo( iconToolBar ); |
725 | if (p-> mShowIconJournal) | 725 | if (p-> mShowIconJournal) |
726 | viewjournal_action->addTo( iconToolBar ); | 726 | viewjournal_action->addTo( iconToolBar ); |
727 | icon = loadPixmap( pathString + "2leftarrowB" ); | 727 | icon = loadPixmap( pathString + "2leftarrowB" ); |
728 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 728 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
729 | if (p-> mShowIconBackFast) { | 729 | if (p-> mShowIconBackFast) { |
730 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 730 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
731 | connect( action, SIGNAL( activated() ), | 731 | connect( action, SIGNAL( activated() ), |
732 | mView, SLOT( goPreviousMonth() ) ); | 732 | mView, SLOT( goPreviousMonth() ) ); |
733 | action->addTo( iconToolBar ); | 733 | action->addTo( iconToolBar ); |
734 | } | 734 | } |
735 | icon = loadPixmap( pathString + "1leftarrowB" ); | 735 | icon = loadPixmap( pathString + "1leftarrowB" ); |
736 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 736 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
737 | if (p-> mShowIconBack) { | 737 | if (p-> mShowIconBack) { |
738 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 738 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
739 | connect( action, SIGNAL( activated() ), | 739 | connect( action, SIGNAL( activated() ), |
740 | mView, SLOT( goPrevious() ) ); | 740 | mView, SLOT( goPrevious() ) ); |
741 | action->addTo( iconToolBar ); | 741 | action->addTo( iconToolBar ); |
742 | } | 742 | } |
743 | if (p-> mShowIconToday) | 743 | if (p-> mShowIconToday) |
744 | today_action->addTo( iconToolBar ); | 744 | today_action->addTo( iconToolBar ); |
745 | icon = loadPixmap( pathString + "1rightarrowB" ); | 745 | icon = loadPixmap( pathString + "1rightarrowB" ); |
746 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 746 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
747 | if (p-> mShowIconForward) { | 747 | if (p-> mShowIconForward) { |
748 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 748 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
749 | connect( action, SIGNAL( activated() ), | 749 | connect( action, SIGNAL( activated() ), |
750 | mView, SLOT( goNext() ) ); | 750 | mView, SLOT( goNext() ) ); |
751 | action->addTo( iconToolBar ); | 751 | action->addTo( iconToolBar ); |
752 | } | 752 | } |
753 | icon = loadPixmap( pathString + "2rightarrowB" ); | 753 | icon = loadPixmap( pathString + "2rightarrowB" ); |
754 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 754 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
755 | if (p-> mShowIconForwardFast) { | 755 | if (p-> mShowIconForwardFast) { |
756 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 756 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
757 | connect( action, SIGNAL( activated() ), | 757 | connect( action, SIGNAL( activated() ), |
758 | mView, SLOT( goNextMonth() ) ); | 758 | mView, SLOT( goNextMonth() ) ); |
759 | action->addTo( iconToolBar ); | 759 | action->addTo( iconToolBar ); |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 763 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
764 | 764 | ||
765 | if (p-> mShowIconNewEvent) | 765 | if (p-> mShowIconNewEvent) |
766 | configureToolBarMenu->setItemChecked( 10, true ); | 766 | configureToolBarMenu->setItemChecked( 10, true ); |
767 | if (p->mShowIconNewTodo ) | 767 | if (p->mShowIconNewTodo ) |
768 | configureToolBarMenu->setItemChecked( 20, true ); | 768 | configureToolBarMenu->setItemChecked( 20, true ); |
769 | if (p-> mShowIconSearch) | 769 | if (p-> mShowIconSearch) |
770 | configureToolBarMenu->setItemChecked( 120, true ); | 770 | configureToolBarMenu->setItemChecked( 120, true ); |
771 | if (p-> mShowIconList) | 771 | if (p-> mShowIconList) |
772 | configureToolBarMenu->setItemChecked( 30, true ); | 772 | configureToolBarMenu->setItemChecked( 30, true ); |
773 | if (p-> mShowIconDay1) | 773 | if (p-> mShowIconDay1) |
774 | configureToolBarMenu->setItemChecked( 40, true ); | 774 | configureToolBarMenu->setItemChecked( 40, true ); |
775 | if (p-> mShowIconDay5) | 775 | if (p-> mShowIconDay5) |
776 | configureToolBarMenu->setItemChecked( 50, true ); | 776 | configureToolBarMenu->setItemChecked( 50, true ); |
777 | if (p-> mShowIconDay7) | 777 | if (p-> mShowIconDay7) |
778 | configureToolBarMenu->setItemChecked( 60, true ); | 778 | configureToolBarMenu->setItemChecked( 60, true ); |
779 | if (p-> mShowIconMonth) | 779 | if (p-> mShowIconMonth) |
780 | configureToolBarMenu->setItemChecked( 70, true ); | 780 | configureToolBarMenu->setItemChecked( 70, true ); |
781 | if (p-> mShowIconTodoview) | 781 | if (p-> mShowIconTodoview) |
782 | configureToolBarMenu->setItemChecked( 80, true ); | 782 | configureToolBarMenu->setItemChecked( 80, true ); |
783 | if (p-> mShowIconBackFast) | 783 | if (p-> mShowIconBackFast) |
784 | configureToolBarMenu->setItemChecked( 200, true ); | 784 | configureToolBarMenu->setItemChecked( 200, true ); |
785 | if (p-> mShowIconBack) | 785 | if (p-> mShowIconBack) |
786 | configureToolBarMenu->setItemChecked( 210, true ); | 786 | configureToolBarMenu->setItemChecked( 210, true ); |
787 | if (p-> mShowIconToday) | 787 | if (p-> mShowIconToday) |
788 | configureToolBarMenu->setItemChecked( 130, true ); | 788 | configureToolBarMenu->setItemChecked( 130, true ); |
789 | if (p-> mShowIconForward) | 789 | if (p-> mShowIconForward) |
790 | configureToolBarMenu->setItemChecked( 220, true ); | 790 | configureToolBarMenu->setItemChecked( 220, true ); |
791 | if (p-> mShowIconForwardFast) | 791 | if (p-> mShowIconForwardFast) |
792 | configureToolBarMenu->setItemChecked( 230, true ); | 792 | configureToolBarMenu->setItemChecked( 230, true ); |
793 | if (p-> mShowIconNextDays) | 793 | if (p-> mShowIconNextDays) |
794 | configureToolBarMenu->setItemChecked( 100, true ); | 794 | configureToolBarMenu->setItemChecked( 100, true ); |
795 | if (p-> mShowIconNext) | 795 | if (p-> mShowIconNext) |
796 | configureToolBarMenu->setItemChecked( 110, true ); | 796 | configureToolBarMenu->setItemChecked( 110, true ); |
797 | if (p-> mShowIconJournal) | 797 | if (p-> mShowIconJournal) |
798 | configureToolBarMenu->setItemChecked( 90, true ); | 798 | configureToolBarMenu->setItemChecked( 90, true ); |
799 | if (p-> mShowIconWhatsThis) | 799 | if (p-> mShowIconWhatsThis) |
800 | configureToolBarMenu->setItemChecked( 300, true ); | 800 | configureToolBarMenu->setItemChecked( 300, true ); |
801 | 801 | ||
802 | QLabel* dummy = new QLabel( iconToolBar ); | 802 | QLabel* dummy = new QLabel( iconToolBar ); |
803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 803 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
804 | if (!p-> mShowIconStretch) | 804 | if (!p-> mShowIconStretch) |
805 | iconToolBar->setStretchableWidget ( dummy ) ; | 805 | iconToolBar->setStretchableWidget ( dummy ) ; |
806 | else | 806 | else |
807 | configureToolBarMenu->setItemChecked( 5, true ); | 807 | configureToolBarMenu->setItemChecked( 5, true ); |
808 | if (p-> mShowIconWhatsThis) | 808 | if (p-> mShowIconWhatsThis) |
809 | QWhatsThis::whatsThisButton ( iconToolBar ); | 809 | QWhatsThis::whatsThisButton ( iconToolBar ); |
810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 810 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
811 | configureAgenda( p->mHourSize ); | 811 | configureAgenda( p->mHourSize ); |
812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 812 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
813 | } | 813 | } |
814 | void MainWindow::fillSyncMenu() | 814 | void MainWindow::fillSyncMenu() |
815 | { | 815 | { |
816 | syncMenu->clear(); | 816 | syncMenu->clear(); |
817 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 817 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
818 | syncMenu->insertSeparator(); | 818 | syncMenu->insertSeparator(); |
819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 819 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
820 | syncMenu->insertSeparator(); | 820 | syncMenu->insertSeparator(); |
821 | 821 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | |
822 | QStringList prof = KOPrefs::instance()->mSyncProfileNames; | 822 | config.setGroup("SyncProfiles"); |
823 | 823 | QStringList prof = config.readListEntry("SyncProfileNames"); | |
824 | |||
824 | if ( prof.count() < 3 ) { | 825 | if ( prof.count() < 3 ) { |
825 | KConfig *config = KOGlobals::config(); | ||
826 | prof.clear(); | 826 | prof.clear(); |
827 | prof << i18n("Sharp-DTM"); | 827 | prof << i18n("Sharp-DTM"); |
828 | prof << i18n("Local file"); | 828 | prof << i18n("Local file"); |
829 | prof << i18n("Last file"); | 829 | prof << i18n("Last file"); |
830 | KSyncProfile* temp = new KSyncProfile (); | 830 | KSyncProfile* temp = new KSyncProfile (); |
831 | temp->setName( prof[0] ); | 831 | temp->setName( prof[0] ); |
832 | temp->writeConfig(config); | 832 | temp->writeConfig(&config); |
833 | temp->setName( prof[1] ); | 833 | temp->setName( prof[1] ); |
834 | temp->writeConfig(config); | 834 | temp->writeConfig(&config); |
835 | temp->setName( prof[2] ); | 835 | temp->setName( prof[2] ); |
836 | temp->writeConfig(config); | 836 | temp->writeConfig(&config); |
837 | config->sync(); | 837 | config.sync(); |
838 | delete temp; | 838 | delete temp; |
839 | KOPrefs::instance()->mSyncProfileNames = prof; | ||
840 | } | 839 | } |
841 | 840 | KOPrefs::instance()->mSyncProfileNames = prof; | |
842 | int i; | 841 | int i; |
843 | for ( i = 0; i < prof.count(); ++i ) { | 842 | for ( i = 0; i < prof.count(); ++i ) { |
844 | 843 | ||
845 | syncMenu->insertItem( prof[i], 1000+i ); | 844 | syncMenu->insertItem( prof[i], 1000+i ); |
846 | if ( i == 2 ) | 845 | if ( i == 2 ) |
847 | syncMenu->insertSeparator(); | 846 | syncMenu->insertSeparator(); |
848 | } | 847 | } |
849 | QDir app_dir; | 848 | QDir app_dir; |
850 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 849 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
851 | syncMenu->setItemEnabled( false , 1000 ); | 850 | syncMenu->setItemEnabled( false , 1000 ); |
852 | } | 851 | } |
853 | } | 852 | } |
854 | 853 | ||
855 | int MainWindow::ringSync() | 854 | int MainWindow::ringSync() |
856 | { | 855 | { |
857 | int syncedProfiles = 0; | 856 | int syncedProfiles = 0; |
858 | int i; | 857 | int i; |
859 | QTime timer; | 858 | QTime timer; |
860 | KConfig *config = KOGlobals::config(); | 859 | KConfig *config = KOGlobals::config(); |
861 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 860 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
862 | KSyncProfile* temp = new KSyncProfile (); | 861 | KSyncProfile* temp = new KSyncProfile (); |
863 | KOPrefs::instance()->mAskForPreferences = false; | 862 | KOPrefs::instance()->mAskForPreferences = false; |
864 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 863 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
865 | mCurrentSyncProfile = i; | 864 | mCurrentSyncProfile = i; |
866 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 865 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
867 | temp->readConfig(config); | 866 | temp->readConfig(config); |
868 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 867 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
869 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 868 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
870 | ++syncedProfiles; | 869 | ++syncedProfiles; |
871 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 870 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
872 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 871 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
873 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 872 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
874 | KOPrefs::instance()->mShowSyncSummary = false; | 873 | KOPrefs::instance()->mShowSyncSummary = false; |
875 | mView->setSyncDevice(syncProfileNames[i] ); | 874 | mView->setSyncDevice(syncProfileNames[i] ); |
876 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 875 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
877 | if ( i == 0 ) { | 876 | if ( i == 0 ) { |
878 | syncSharp(); | 877 | syncSharp(); |
879 | } else { | 878 | } else { |
880 | if ( temp->getIsLocalFileSync() ) { | 879 | if ( temp->getIsLocalFileSync() ) { |
881 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 880 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
882 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 881 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
883 | } else { | 882 | } else { |
884 | syncRemote( temp, false ); | 883 | syncRemote( temp, false ); |
885 | 884 | ||
886 | } | 885 | } |
887 | } | 886 | } |
888 | timer.start(); | 887 | timer.start(); |
889 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 888 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
890 | while ( timer.elapsed () < 2000 ) { | 889 | while ( timer.elapsed () < 2000 ) { |
891 | qApp->processEvents(); | 890 | qApp->processEvents(); |
892 | #ifndef _WIN32_ | 891 | #ifndef _WIN32_ |
893 | sleep (1); | 892 | sleep (1); |
894 | #endif | 893 | #endif |
895 | } | 894 | } |
896 | 895 | ||
897 | } | 896 | } |
898 | 897 | ||
899 | } | 898 | } |
900 | delete temp; | 899 | delete temp; |
901 | return syncedProfiles; | 900 | return syncedProfiles; |
902 | } | 901 | } |
903 | 902 | ||
904 | void MainWindow::multiSync( bool askforPrefs ) | 903 | void MainWindow::multiSync( bool askforPrefs ) |
905 | { | 904 | { |
906 | if (mBlockSaveFlag) | 905 | if (mBlockSaveFlag) |
907 | return; | 906 | return; |
908 | mBlockSaveFlag = true; | 907 | mBlockSaveFlag = true; |
909 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 908 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
910 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 909 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
911 | question, | 910 | question, |
912 | i18n("Yes"), i18n("No"), | 911 | i18n("Yes"), i18n("No"), |
913 | 0, 0 ) != 0 ) { | 912 | 0, 0 ) != 0 ) { |
914 | mBlockSaveFlag = false; | 913 | mBlockSaveFlag = false; |
915 | setCaption(i18n("Aborted! Nothing synced!")); | 914 | setCaption(i18n("Aborted! Nothing synced!")); |
916 | return; | 915 | return; |
917 | } | 916 | } |
918 | mView->setSyncDevice(i18n("Multiple profiles") ); | 917 | mView->setSyncDevice(i18n("Multiple profiles") ); |
919 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 918 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
920 | if ( askforPrefs ) { | 919 | if ( askforPrefs ) { |
921 | mView->edit_sync_options(); | 920 | mView->edit_sync_options(); |
922 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 921 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
923 | } | 922 | } |
924 | setCaption(i18n("Multiple sync started.") ); | 923 | setCaption(i18n("Multiple sync started.") ); |
925 | qApp->processEvents(); | 924 | qApp->processEvents(); |
926 | int num = ringSync() ; | 925 | int num = ringSync() ; |
927 | if ( num > 1 ) | 926 | if ( num > 1 ) |
928 | ringSync(); | 927 | ringSync(); |
929 | mBlockSaveFlag = false; | 928 | mBlockSaveFlag = false; |
930 | if ( num ) | 929 | if ( num ) |
931 | save(); | 930 | save(); |
932 | if ( num ) | 931 | if ( num ) |
933 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 932 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
934 | else | 933 | else |
935 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 934 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
936 | return; | 935 | return; |
937 | } | 936 | } |
938 | void MainWindow::slotSyncMenu( int action ) | 937 | void MainWindow::slotSyncMenu( int action ) |
939 | { | 938 | { |
940 | //qDebug("syncaction %d ", action); | 939 | //qDebug("syncaction %d ", action); |
941 | if ( action == 0 ) { | 940 | if ( action == 0 ) { |
942 | 941 | ||
943 | confSync(); | 942 | confSync(); |
944 | 943 | ||
945 | return; | 944 | return; |
946 | } | 945 | } |
947 | if ( action == 1 ) { | 946 | if ( action == 1 ) { |
948 | multiSync( true ); | 947 | multiSync( true ); |
949 | return; | 948 | return; |
950 | } | 949 | } |
951 | 950 | ||
952 | if (mBlockSaveFlag) | 951 | if (mBlockSaveFlag) |
953 | return; | 952 | return; |
954 | mBlockSaveFlag = true; | 953 | mBlockSaveFlag = true; |
955 | mCurrentSyncProfile = action - 1000 ; | 954 | mCurrentSyncProfile = action - 1000 ; |
956 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 955 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
957 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 956 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
958 | KConfig *config = KOGlobals::config(); | 957 | KConfig *config = KOGlobals::config(); |
959 | KSyncProfile* temp = new KSyncProfile (); | 958 | KSyncProfile* temp = new KSyncProfile (); |
960 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 959 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
961 | temp->readConfig(config); | 960 | temp->readConfig(config); |
962 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 961 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
963 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 962 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
964 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 963 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
965 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 964 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
966 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 965 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
967 | if ( action == 1000 ) { | 966 | if ( action == 1000 ) { |
968 | syncSharp(); | 967 | syncSharp(); |
969 | 968 | ||
970 | } else if ( action == 1001 ) { | 969 | } else if ( action == 1001 ) { |
971 | syncLocalFile(); | 970 | syncLocalFile(); |
972 | 971 | ||
973 | } else if ( action == 1002 ) { | 972 | } else if ( action == 1002 ) { |
974 | quickSyncLocalFile(); | 973 | quickSyncLocalFile(); |
975 | 974 | ||
976 | } else if ( action >= 1003 ) { | 975 | } else if ( action >= 1003 ) { |
977 | if ( temp->getIsLocalFileSync() ) { | 976 | if ( temp->getIsLocalFileSync() ) { |
978 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 977 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
979 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 978 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
980 | } else { | 979 | } else { |
981 | syncRemote( temp ); | 980 | syncRemote( temp ); |
982 | 981 | ||
983 | } | 982 | } |
984 | } | 983 | } |
985 | delete temp; | 984 | delete temp; |
986 | mBlockSaveFlag = false; | 985 | mBlockSaveFlag = false; |
987 | } | 986 | } |
988 | void MainWindow::setDefaultPreferences() | 987 | void MainWindow::setDefaultPreferences() |
989 | { | 988 | { |
990 | KOPrefs *p = KOPrefs::instance(); | 989 | KOPrefs *p = KOPrefs::instance(); |
991 | 990 | ||
992 | p->mCompactDialogs = true; | 991 | p->mCompactDialogs = true; |
993 | p->mConfirm = true; | 992 | p->mConfirm = true; |
994 | // p->mEnableQuickTodo = false; | 993 | // p->mEnableQuickTodo = false; |
995 | } | 994 | } |
996 | 995 | ||
997 | QString MainWindow::resourcePath() | 996 | QString MainWindow::resourcePath() |
998 | { | 997 | { |
999 | return KGlobal::iconLoader()->iconPath(); | 998 | return KGlobal::iconLoader()->iconPath(); |
1000 | } | 999 | } |
1001 | 1000 | ||
1002 | void MainWindow::displayText( QString text ,QString cap ) | 1001 | void MainWindow::displayText( QString text ,QString cap ) |
1003 | { | 1002 | { |
1004 | QDialog dia( this, "name", true ); ; | 1003 | QDialog dia( this, "name", true ); ; |
1005 | dia.setCaption( cap ); | 1004 | dia.setCaption( cap ); |
1006 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1005 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1007 | lay->setSpacing( 3 ); | 1006 | lay->setSpacing( 3 ); |
1008 | lay->setMargin( 3 ); | 1007 | lay->setMargin( 3 ); |
1009 | QTextBrowser tb ( &dia ); | 1008 | QTextBrowser tb ( &dia ); |
1010 | lay->addWidget( &tb ); | 1009 | lay->addWidget( &tb ); |
1011 | tb.setText( text ); | 1010 | tb.setText( text ); |
1012 | #ifdef DESKTOP_VERSION | 1011 | #ifdef DESKTOP_VERSION |
1013 | dia.resize( 640, 480); | 1012 | dia.resize( 640, 480); |
1014 | #else | 1013 | #else |
1015 | dia.showMaximized(); | 1014 | dia.showMaximized(); |
1016 | #endif | 1015 | #endif |
1017 | dia.exec(); | 1016 | dia.exec(); |
1018 | } | 1017 | } |
1019 | void MainWindow::displayFile( QString fn, QString cap ) | 1018 | void MainWindow::displayFile( QString fn, QString cap ) |
1020 | { | 1019 | { |
1021 | QString fileName = resourcePath() + fn; | 1020 | QString fileName = resourcePath() + fn; |
1022 | QString text; | 1021 | QString text; |
1023 | QFile file( fileName ); | 1022 | QFile file( fileName ); |
1024 | if (!file.open( IO_ReadOnly ) ) { | 1023 | if (!file.open( IO_ReadOnly ) ) { |
1025 | return ; | 1024 | return ; |
1026 | 1025 | ||
1027 | } | 1026 | } |
1028 | QTextStream ts( &file ); | 1027 | QTextStream ts( &file ); |
1029 | text = ts.read(); | 1028 | text = ts.read(); |
1030 | file.close(); | 1029 | file.close(); |
1031 | displayText( text, cap); | 1030 | displayText( text, cap); |
1032 | } | 1031 | } |
1033 | void MainWindow::features() | 1032 | void MainWindow::features() |
@@ -1611,384 +1610,384 @@ void MainWindow::loadCalendar() | |||
1611 | loadbup = false; | 1610 | loadbup = false; |
1612 | } | 1611 | } |
1613 | } else { | 1612 | } else { |
1614 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1613 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1615 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1614 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1616 | 0, 1 ); | 1615 | 0, 1 ); |
1617 | 1616 | ||
1618 | return; | 1617 | return; |
1619 | } | 1618 | } |
1620 | if ( loadbup ) { | 1619 | if ( loadbup ) { |
1621 | mView->openCalendar( fn ); | 1620 | mView->openCalendar( fn ); |
1622 | KOPrefs::instance()->mLastLoadFile = fn; | 1621 | KOPrefs::instance()->mLastLoadFile = fn; |
1623 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1622 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1624 | setCaption(mess); | 1623 | setCaption(mess); |
1625 | } | 1624 | } |
1626 | 1625 | ||
1627 | } | 1626 | } |
1628 | void MainWindow::quickImportIcal() | 1627 | void MainWindow::quickImportIcal() |
1629 | { | 1628 | { |
1630 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1629 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1631 | } | 1630 | } |
1632 | void MainWindow::importFile( QString fn, bool quick ) | 1631 | void MainWindow::importFile( QString fn, bool quick ) |
1633 | { | 1632 | { |
1634 | QFileInfo info; | 1633 | QFileInfo info; |
1635 | info.setFile( fn ); | 1634 | info.setFile( fn ); |
1636 | QString mess; | 1635 | QString mess; |
1637 | bool loadbup = true; | 1636 | bool loadbup = true; |
1638 | if ( !info. exists() ) { | 1637 | if ( !info. exists() ) { |
1639 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1638 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1640 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1639 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1641 | mess ); | 1640 | mess ); |
1642 | return; | 1641 | return; |
1643 | } | 1642 | } |
1644 | int result = 0; | 1643 | int result = 0; |
1645 | if ( !quick ) { | 1644 | if ( !quick ) { |
1646 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1645 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1647 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1646 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1648 | mess, | 1647 | mess, |
1649 | "Import", "Cancel", 0, | 1648 | "Import", "Cancel", 0, |
1650 | 0, 1 ); | 1649 | 0, 1 ); |
1651 | } | 1650 | } |
1652 | if ( result == 0 ) { | 1651 | if ( result == 0 ) { |
1653 | if ( mView->openCalendar( fn, true )) { | 1652 | if ( mView->openCalendar( fn, true )) { |
1654 | KOPrefs::instance()->mLastImportFile = fn; | 1653 | KOPrefs::instance()->mLastImportFile = fn; |
1655 | setCaption(i18n("Imported file successfully")); | 1654 | setCaption(i18n("Imported file successfully")); |
1656 | } else { | 1655 | } else { |
1657 | setCaption(i18n("Error importing file")); | 1656 | setCaption(i18n("Error importing file")); |
1658 | } | 1657 | } |
1659 | } | 1658 | } |
1660 | } | 1659 | } |
1661 | 1660 | ||
1662 | void MainWindow::importIcal() | 1661 | void MainWindow::importIcal() |
1663 | { | 1662 | { |
1664 | 1663 | ||
1665 | QString fn =KOPrefs::instance()->mLastImportFile; | 1664 | QString fn =KOPrefs::instance()->mLastImportFile; |
1666 | 1665 | ||
1667 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1666 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1668 | if ( fn == "" ) | 1667 | if ( fn == "" ) |
1669 | return; | 1668 | return; |
1670 | importFile( fn, true ); | 1669 | importFile( fn, true ); |
1671 | 1670 | ||
1672 | } | 1671 | } |
1673 | 1672 | ||
1674 | void MainWindow::exportVCalendar() | 1673 | void MainWindow::exportVCalendar() |
1675 | { | 1674 | { |
1676 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1675 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1677 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1676 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1678 | if ( fn == "" ) | 1677 | if ( fn == "" ) |
1679 | return; | 1678 | return; |
1680 | QFileInfo info; | 1679 | QFileInfo info; |
1681 | info.setFile( fn ); | 1680 | info.setFile( fn ); |
1682 | QString mes; | 1681 | QString mes; |
1683 | bool createbup = true; | 1682 | bool createbup = true; |
1684 | if ( info. exists() ) { | 1683 | if ( info. exists() ) { |
1685 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1684 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1686 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1685 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1687 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1686 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1688 | 0, 1 ); | 1687 | 0, 1 ); |
1689 | if ( result != 0 ) { | 1688 | if ( result != 0 ) { |
1690 | createbup = false; | 1689 | createbup = false; |
1691 | } | 1690 | } |
1692 | } | 1691 | } |
1693 | if ( createbup ) { | 1692 | if ( createbup ) { |
1694 | if ( mView->exportVCalendar( fn ) ) { | 1693 | if ( mView->exportVCalendar( fn ) ) { |
1695 | KOPrefs::instance()->mLastVcalFile = fn; | 1694 | KOPrefs::instance()->mLastVcalFile = fn; |
1696 | if ( fn.length() > 20 ) | 1695 | if ( fn.length() > 20 ) |
1697 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1696 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1698 | else | 1697 | else |
1699 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1698 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1700 | setCaption(mes); | 1699 | setCaption(mes); |
1701 | } | 1700 | } |
1702 | } | 1701 | } |
1703 | 1702 | ||
1704 | } | 1703 | } |
1705 | #include <qpushbutton.h> | 1704 | #include <qpushbutton.h> |
1706 | QString MainWindow::getPassword( ) | 1705 | QString MainWindow::getPassword( ) |
1707 | { | 1706 | { |
1708 | QString retfile = ""; | 1707 | QString retfile = ""; |
1709 | QDialog dia ( this, "input-dialog", true ); | 1708 | QDialog dia ( this, "input-dialog", true ); |
1710 | QLineEdit lab ( &dia ); | 1709 | QLineEdit lab ( &dia ); |
1711 | lab.setEchoMode( QLineEdit::Password ); | 1710 | lab.setEchoMode( QLineEdit::Password ); |
1712 | QVBoxLayout lay( &dia ); | 1711 | QVBoxLayout lay( &dia ); |
1713 | lay.setMargin(7); | 1712 | lay.setMargin(7); |
1714 | lay.setSpacing(7); | 1713 | lay.setSpacing(7); |
1715 | lay.addWidget( &lab); | 1714 | lay.addWidget( &lab); |
1716 | dia.setFixedSize( 230,50 ); | 1715 | dia.setFixedSize( 230,50 ); |
1717 | dia.setCaption( i18n("Enter password") ); | 1716 | dia.setCaption( i18n("Enter password") ); |
1718 | QPushButton pb ( "OK", &dia); | 1717 | QPushButton pb ( "OK", &dia); |
1719 | lay.addWidget( &pb ); | 1718 | lay.addWidget( &pb ); |
1720 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1719 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1721 | dia.show(); | 1720 | dia.show(); |
1722 | int res = dia.exec(); | 1721 | int res = dia.exec(); |
1723 | if ( res ) | 1722 | if ( res ) |
1724 | retfile = lab.text(); | 1723 | retfile = lab.text(); |
1725 | dia.hide(); | 1724 | dia.hide(); |
1726 | qApp->processEvents(); | 1725 | qApp->processEvents(); |
1727 | return retfile; | 1726 | return retfile; |
1728 | 1727 | ||
1729 | } | 1728 | } |
1730 | 1729 | ||
1731 | void MainWindow::syncLocalFile() | 1730 | void MainWindow::syncLocalFile() |
1732 | { | 1731 | { |
1733 | 1732 | ||
1734 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 1733 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
1735 | 1734 | ||
1736 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 1735 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
1737 | if ( fn == "" ) | 1736 | if ( fn == "" ) |
1738 | return; | 1737 | return; |
1739 | //mView->setSyncDevice("local-file" ); | 1738 | //mView->setSyncDevice("local-file" ); |
1740 | if ( syncWithFile( fn, false ) ) { | 1739 | if ( syncWithFile( fn, false ) ) { |
1741 | // Event* e = mView->getLastSyncEvent(); | 1740 | // Event* e = mView->getLastSyncEvent(); |
1742 | // e->setReadOnly( false ); | 1741 | // e->setReadOnly( false ); |
1743 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1742 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1744 | // e->setReadOnly( true ); | 1743 | // e->setReadOnly( true ); |
1745 | } | 1744 | } |
1746 | 1745 | ||
1747 | } | 1746 | } |
1748 | 1747 | ||
1749 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 1748 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
1750 | { | 1749 | { |
1751 | bool ret = false; | 1750 | bool ret = false; |
1752 | QFileInfo info; | 1751 | QFileInfo info; |
1753 | info.setFile( fn ); | 1752 | info.setFile( fn ); |
1754 | QString mess; | 1753 | QString mess; |
1755 | bool loadbup = true; | 1754 | bool loadbup = true; |
1756 | if ( !info. exists() ) { | 1755 | if ( !info. exists() ) { |
1757 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 1756 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
1758 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1757 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1759 | mess ); | 1758 | mess ); |
1760 | return ret; | 1759 | return ret; |
1761 | } | 1760 | } |
1762 | int result = 0; | 1761 | int result = 0; |
1763 | if ( !quick ) { | 1762 | if ( !quick ) { |
1764 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1763 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1765 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1764 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1766 | mess, | 1765 | mess, |
1767 | i18n("Sync"), i18n("Cancel"), 0, | 1766 | i18n("Sync"), i18n("Cancel"), 0, |
1768 | 0, 1 ); | 1767 | 0, 1 ); |
1769 | if ( result ) | 1768 | if ( result ) |
1770 | return false; | 1769 | return false; |
1771 | } | 1770 | } |
1772 | if ( KOPrefs::instance()->mAskForPreferences ) | 1771 | if ( KOPrefs::instance()->mAskForPreferences ) |
1773 | mView->edit_sync_options(); | 1772 | mView->edit_sync_options(); |
1774 | if ( result == 0 ) { | 1773 | if ( result == 0 ) { |
1775 | //qDebug("Now sycing ... "); | 1774 | //qDebug("Now sycing ... "); |
1776 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | 1775 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) |
1777 | setCaption( i18n("Synchronization successful") ); | 1776 | setCaption( i18n("Synchronization successful") ); |
1778 | else | 1777 | else |
1779 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 1778 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
1780 | if ( ! quick ) | 1779 | if ( ! quick ) |
1781 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | 1780 | KOPrefs::instance()->mLastSyncedLocalFile = fn; |
1782 | slotModifiedChanged( true ); | 1781 | slotModifiedChanged( true ); |
1783 | } | 1782 | } |
1784 | return ret; | 1783 | return ret; |
1785 | } | 1784 | } |
1786 | void MainWindow::quickSyncLocalFile() | 1785 | void MainWindow::quickSyncLocalFile() |
1787 | { | 1786 | { |
1788 | //mView->setSyncDevice("local-file" ); | 1787 | //mView->setSyncDevice("local-file" ); |
1789 | //qDebug("quickSyncLocalFile() "); | 1788 | //qDebug("quickSyncLocalFile() "); |
1790 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | 1789 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { |
1791 | // Event* e = mView->getLastSyncEvent(); | 1790 | // Event* e = mView->getLastSyncEvent(); |
1792 | // e->setReadOnly( false ); | 1791 | // e->setReadOnly( false ); |
1793 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1792 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1794 | // e->setReadOnly( true ); | 1793 | // e->setReadOnly( true ); |
1795 | 1794 | ||
1796 | } | 1795 | } |
1797 | } | 1796 | } |
1798 | 1797 | ||
1799 | void MainWindow::confSync() | 1798 | void MainWindow::confSync() |
1800 | { | 1799 | { |
1801 | mView->confSync(); | 1800 | mView->confSync(); |
1802 | fillSyncMenu(); | 1801 | fillSyncMenu(); |
1803 | mView->writeSettings(); | 1802 | //mView->writeSettings(); |
1804 | 1803 | ||
1805 | 1804 | ||
1806 | } | 1805 | } |
1807 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | 1806 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) |
1808 | { | 1807 | { |
1809 | QString question; | 1808 | QString question; |
1810 | if ( ask ) { | 1809 | if ( ask ) { |
1811 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 1810 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
1812 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1811 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1813 | question, | 1812 | question, |
1814 | i18n("Yes"), i18n("No"), | 1813 | i18n("Yes"), i18n("No"), |
1815 | 0, 0 ) != 0 ) | 1814 | 0, 0 ) != 0 ) |
1816 | return; | 1815 | return; |
1817 | } | 1816 | } |
1818 | QString command = prof->getPreSyncCommand(); | 1817 | QString command = prof->getPreSyncCommand(); |
1819 | int fi; | 1818 | int fi; |
1820 | if ( (fi = command.find("$PWD$")) > 0 ) { | 1819 | if ( (fi = command.find("$PWD$")) > 0 ) { |
1821 | QString pwd = getPassword(); | 1820 | QString pwd = getPassword(); |
1822 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 1821 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
1823 | 1822 | ||
1824 | } | 1823 | } |
1825 | int maxlen = 30; | 1824 | int maxlen = 30; |
1826 | if ( QApplication::desktop()->width() > 320 ) | 1825 | if ( QApplication::desktop()->width() > 320 ) |
1827 | maxlen += 25; | 1826 | maxlen += 25; |
1828 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1827 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1829 | int fileSize = 0; | 1828 | int fileSize = 0; |
1830 | int result = system ( command ); | 1829 | int result = system ( command ); |
1831 | // 0 : okay | 1830 | // 0 : okay |
1832 | // 256: no such file or dir | 1831 | // 256: no such file or dir |
1833 | // | 1832 | // |
1834 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1833 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1835 | if ( result != 0 ) { | 1834 | if ( result != 0 ) { |
1836 | int len = maxlen; | 1835 | int len = maxlen; |
1837 | while ( len < command.length() ) { | 1836 | while ( len < command.length() ) { |
1838 | command.insert( len , "\n" ); | 1837 | command.insert( len , "\n" ); |
1839 | len += maxlen +2; | 1838 | len += maxlen +2; |
1840 | } | 1839 | } |
1841 | 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 (command) ; | 1840 | 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 (command) ; |
1842 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1841 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1843 | question, | 1842 | question, |
1844 | i18n("Okay!")) ; | 1843 | i18n("Okay!")) ; |
1845 | setCaption ("KO/Pi"); | 1844 | setCaption ("KO/Pi"); |
1846 | return; | 1845 | return; |
1847 | } | 1846 | } |
1848 | setCaption ( i18n( "Copying succeed." ) ); | 1847 | setCaption ( i18n( "Copying succeed." ) ); |
1849 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 1848 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
1850 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 1849 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
1851 | // Event* e = mView->getLastSyncEvent(); | 1850 | // Event* e = mView->getLastSyncEvent(); |
1852 | // e->setReadOnly( false ); | 1851 | // e->setReadOnly( false ); |
1853 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1852 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1854 | // e->setReadOnly( true ); | 1853 | // e->setReadOnly( true ); |
1855 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1854 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1856 | command = prof->getPostSyncCommand(); | 1855 | command = prof->getPostSyncCommand(); |
1857 | setCaption ( i18n( "Writing back file ..." ) ); | 1856 | setCaption ( i18n( "Writing back file ..." ) ); |
1858 | result = system ( command ); | 1857 | result = system ( command ); |
1859 | qDebug("KO: Writing back file result: %d ", result); | 1858 | qDebug("KO: Writing back file result: %d ", result); |
1860 | if ( result != 0 ) { | 1859 | if ( result != 0 ) { |
1861 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 1860 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
1862 | return; | 1861 | return; |
1863 | } else { | 1862 | } else { |
1864 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 1863 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1865 | } | 1864 | } |
1866 | } | 1865 | } |
1867 | } | 1866 | } |
1868 | return; | 1867 | return; |
1869 | } | 1868 | } |
1870 | void MainWindow::syncSSH() | 1869 | void MainWindow::syncSSH() |
1871 | { | 1870 | { |
1872 | // not used anymore | 1871 | // not used anymore |
1873 | QTime timer; | 1872 | QTime timer; |
1874 | timer.start(); | 1873 | timer.start(); |
1875 | //qDebug("MainWindow::syncssh() "); | 1874 | //qDebug("MainWindow::syncssh() "); |
1876 | KOPrefs *p = KOPrefs::instance(); | 1875 | KOPrefs *p = KOPrefs::instance(); |
1877 | QString localFile = p->mLocalTempFile; | 1876 | QString localFile = p->mLocalTempFile; |
1878 | QString remoteIP = p->mRemoteIP; | 1877 | QString remoteIP = p->mRemoteIP; |
1879 | QString remoteUser = p->mRemoteUser; | 1878 | QString remoteUser = p->mRemoteUser; |
1880 | QString remoteFile = p->mRemoteFile; | 1879 | QString remoteFile = p->mRemoteFile; |
1881 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | 1880 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) |
1882 | remoteUser += ":" + p->mRemotePassWd; | 1881 | remoteUser += ":" + p->mRemotePassWd; |
1883 | 1882 | ||
1884 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | 1883 | QString question = i18n("Do you really want\nto remote sync?\n \n") + |
1885 | i18n("IP: " ) +remoteIP +"\n" + | 1884 | i18n("IP: " ) +remoteIP +"\n" + |
1886 | i18n("User: " ) + remoteUser +"\n" ; | 1885 | i18n("User: " ) + remoteUser +"\n" ; |
1887 | int maxlen = 30; | 1886 | int maxlen = 30; |
1888 | if ( QApplication::desktop()->width() > 320 ) | 1887 | if ( QApplication::desktop()->width() > 320 ) |
1889 | maxlen += 25; | 1888 | maxlen += 25; |
1890 | if ( remoteFile.length() > maxlen ) | 1889 | if ( remoteFile.length() > maxlen ) |
1891 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | 1890 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; |
1892 | else | 1891 | else |
1893 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | 1892 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; |
1894 | if ( localFile.length() > maxlen ) | 1893 | if ( localFile.length() > maxlen ) |
1895 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | 1894 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; |
1896 | else | 1895 | else |
1897 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | 1896 | question += i18n("Local temp file:\n " ) + localFile +"\n"; |
1898 | 1897 | ||
1899 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1898 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1900 | question, | 1899 | question, |
1901 | i18n("Yes"), i18n("No"), | 1900 | i18n("Yes"), i18n("No"), |
1902 | 0, 0 ) != 0 ) | 1901 | 0, 0 ) != 0 ) |
1903 | return; | 1902 | return; |
1904 | // if ( !p->mUsePassWd ) { | 1903 | // if ( !p->mUsePassWd ) { |
1905 | // QString pass = getPassword(); | 1904 | // QString pass = getPassword(); |
1906 | // if ( pass.length() > 0 ) | 1905 | // if ( pass.length() > 0 ) |
1907 | // remoteUser += ":" + pass; | 1906 | // remoteUser += ":" + pass; |
1908 | // } | 1907 | // } |
1909 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | 1908 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; |
1910 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1909 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1911 | int fileSize = 0; | 1910 | int fileSize = 0; |
1912 | int result = system ( command ); | 1911 | int result = system ( command ); |
1913 | // 0 : okay | 1912 | // 0 : okay |
1914 | // 256: no such file or dir | 1913 | // 256: no such file or dir |
1915 | // | 1914 | // |
1916 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1915 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1917 | if ( result != 0 ) { | 1916 | if ( result != 0 ) { |
1918 | int len = maxlen; | 1917 | int len = maxlen; |
1919 | while ( len < command.length() ) { | 1918 | while ( len < command.length() ) { |
1920 | command.insert( len , "\n" ); | 1919 | command.insert( len , "\n" ); |
1921 | len += maxlen +2; | 1920 | len += maxlen +2; |
1922 | } | 1921 | } |
1923 | 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 (command) ; | 1922 | 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 (command) ; |
1924 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1923 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1925 | question, | 1924 | question, |
1926 | i18n("Okay!")) ; | 1925 | i18n("Okay!")) ; |
1927 | setCaption ("KO/Pi"); | 1926 | setCaption ("KO/Pi"); |
1928 | return; | 1927 | return; |
1929 | } | 1928 | } |
1930 | 1929 | ||
1931 | 1930 | ||
1932 | setCaption ( i18n( "Copying succeed." ) ); | 1931 | setCaption ( i18n( "Copying succeed." ) ); |
1933 | //mView->setSyncDevice("ssh-scp" ); | 1932 | //mView->setSyncDevice("ssh-scp" ); |
1934 | if ( syncWithFile(localFile , true ) ) { | 1933 | if ( syncWithFile(localFile , true ) ) { |
1935 | // Event* e = mView->getLastSyncEvent(); | 1934 | // Event* e = mView->getLastSyncEvent(); |
1936 | // e->setReadOnly( false ); | 1935 | // e->setReadOnly( false ); |
1937 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1936 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1938 | // e->setReadOnly( true ); | 1937 | // e->setReadOnly( true ); |
1939 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1938 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1940 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | 1939 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; |
1941 | setCaption ( i18n( "Writing back file ..." ) ); | 1940 | setCaption ( i18n( "Writing back file ..." ) ); |
1942 | result = system ( command ); | 1941 | result = system ( command ); |
1943 | if ( result != 0 ) { | 1942 | if ( result != 0 ) { |
1944 | int len = maxlen; | 1943 | int len = maxlen; |
1945 | while ( len < command.length() ) { | 1944 | while ( len < command.length() ) { |
1946 | command.insert( len , "\n" ); | 1945 | command.insert( len , "\n" ); |
1947 | len += maxlen +2; | 1946 | len += maxlen +2; |
1948 | } | 1947 | } |
1949 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1948 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1950 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1949 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1951 | question, | 1950 | question, |
1952 | i18n("Okay!")) ; | 1951 | i18n("Okay!")) ; |
1953 | setCaption ("KO/Pi"); | 1952 | setCaption ("KO/Pi"); |
1954 | return; | 1953 | return; |
1955 | } else { | 1954 | } else { |
1956 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 1955 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1957 | } | 1956 | } |
1958 | } | 1957 | } |
1959 | } | 1958 | } |
1960 | return; | 1959 | return; |
1961 | #if 0 | 1960 | #if 0 |
1962 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | 1961 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); |
1963 | while ( timer.elapsed() < 5000 ) | 1962 | while ( timer.elapsed() < 5000 ) |
1964 | qApp->processEvents(); | 1963 | qApp->processEvents(); |
1965 | 1964 | ||
1966 | qDebug("MainWindow::merging) "); | 1965 | qDebug("MainWindow::merging) "); |
1967 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | 1966 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); |
1968 | while ( mBlockSaveFlag ) | 1967 | while ( mBlockSaveFlag ) |
1969 | qApp->processEvents(); | 1968 | qApp->processEvents(); |
1970 | save(); | 1969 | save(); |
1971 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | 1970 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); |
1972 | #endif | 1971 | #endif |
1973 | 1972 | ||
1974 | } | 1973 | } |
1975 | 1974 | ||
1976 | 1975 | ||
1977 | void MainWindow::syncSharp() | 1976 | void MainWindow::syncSharp() |
1978 | { | 1977 | { |
1979 | if ( mCalendarModifiedFlag ) | 1978 | if ( mCalendarModifiedFlag ) |
1980 | save(); | 1979 | save(); |
1981 | mView->syncSharp(); | 1980 | mView->syncSharp(); |
1982 | slotModifiedChanged( true ); | 1981 | slotModifiedChanged( true ); |
1983 | 1982 | ||
1984 | } | 1983 | } |
1985 | 1984 | ||
1986 | void MainWindow::printSel( ) | 1985 | void MainWindow::printSel( ) |
1987 | { | 1986 | { |
1988 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1987 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
1989 | } | 1988 | } |
1990 | 1989 | ||
1991 | void MainWindow::printCal() | 1990 | void MainWindow::printCal() |
1992 | { | 1991 | { |
1993 | mView->print();//mCp->showDialog(); | 1992 | mView->print();//mCp->showDialog(); |
1994 | } | 1993 | } |