summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-27 11:17:28 (UTC)
committer zautrix <zautrix>2004-10-27 11:17:28 (UTC)
commitf73d249579d52d7aeaacde2dcb23abeb42f9ee95 (patch) (unidiff)
tree75dfc3cd592804c1b87bd2588df2e856a0ac776b /korganizer
parentce5b6b62c92cc051c5c9e780508b6d42c46df8ed (diff)
downloadkdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.zip
kdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.tar.gz
kdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.tar.bz2
compile fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index dc2026b..fc2d59b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -154,257 +154,257 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 228 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 } 231 }
232 processIncidenceSelection( 0 ); 232 processIncidenceSelection( 0 );
233 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 233 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
234 SLOT( processIncidenceSelection( Incidence * ) ) ); 234 SLOT( processIncidenceSelection( Incidence * ) ) );
235 connect( mView, SIGNAL( modifiedChanged( bool ) ), 235 connect( mView, SIGNAL( modifiedChanged( bool ) ),
236 SLOT( slotModifiedChanged( bool ) ) ); 236 SLOT( slotModifiedChanged( bool ) ) );
237 237
238 238
239 connect( mView, SIGNAL( tempDisableBR(bool) ), 239 connect( mView, SIGNAL( tempDisableBR(bool) ),
240 SLOT( disableBR(bool) ) ); 240 SLOT( disableBR(bool) ) );
241 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 241 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
242 mView->setModified( false ); 242 mView->setModified( false );
243 mBlockAtStartup = false; 243 mBlockAtStartup = false;
244 mView->setModified( false ); 244 mView->setModified( false );
245 setCentralWidget( mView ); 245 setCentralWidget( mView );
246 globalFlagBlockStartup = 0; 246 globalFlagBlockStartup = 0;
247 mView->show(); 247 mView->show();
248 delete splash; 248 delete splash;
249 if ( newFile ) 249 if ( newFile )
250 mView->updateConfig(); 250 mView->updateConfig();
251 // qApp->processEvents(); 251 // qApp->processEvents();
252 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 252 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
253 //fillSyncMenu(); 253 //fillSyncMenu();
254 254
255 255
256 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 256 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
257 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 257 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
258 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 258 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
259 mSyncManager->setDefaultFileName( defaultFileName()); 259 mSyncManager->setDefaultFileName( defaultFileName());
260 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 260 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
261 mSyncManager->fillSyncMenu(); 261 mSyncManager->fillSyncMenu();
262 262
263 263
264 264
265 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 265 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
266 if ( showWarning ) { 266 if ( showWarning ) {
267 KMessageBox::information( this, 267 KMessageBox::information( this,
268 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 268 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
269 qApp->processEvents(); 269 qApp->processEvents();
270 mView->dialogManager()->showSyncOptions(); 270 mView->dialogManager()->showSyncOptions();
271 } 271 }
272 272
273 //US listen for result adressed from Ka/Pi 273 //US listen for result adressed from Ka/Pi
274#ifndef DESKTOP_VERSION 274#ifndef DESKTOP_VERSION
275 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 275 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
276#endif 276#endif
277#ifndef DESKTOP_VERSION 277#ifndef DESKTOP_VERSION
278 infrared = 0; 278 infrared = 0;
279#endif 279#endif
280 280
281 mBRdisabled = false; 281 mBRdisabled = false;
282 toggleBeamReceive(); 282 //toggleBeamReceive();
283} 283}
284MainWindow::~MainWindow() 284MainWindow::~MainWindow()
285{ 285{
286 //qDebug("MainWindow::~MainWindow() "); 286 //qDebug("MainWindow::~MainWindow() ");
287 //save toolbar location 287 //save toolbar location
288 delete mCalendar; 288 delete mCalendar;
289 delete mSyncManager; 289 delete mSyncManager;
290#ifndef DESKTOP_VERSION 290#ifndef DESKTOP_VERSION
291 if ( infrared ) 291 if ( infrared )
292 delete infrared; 292 delete infrared;
293#endif 293#endif
294 294
295 295
296} 296}
297 297
298void MainWindow::disableBR(bool b) 298void MainWindow::disableBR(bool b)
299{ 299{
300#ifndef DESKTOP_VERSION 300#ifndef DESKTOP_VERSION
301 if ( b ) { 301 if ( b ) {
302 if ( infrared ) { 302 if ( infrared ) {
303 toggleBeamReceive(); 303 toggleBeamReceive();
304 mBRdisabled = true; 304 mBRdisabled = true;
305 } 305 }
306 mBRdisabled = true; 306 mBRdisabled = true;
307 } else { 307 } else {
308 if ( mBRdisabled ) { 308 if ( mBRdisabled ) {
309 mBRdisabled = false; 309 mBRdisabled = false;
310 //makes no sense,because other cal ap is probably running 310 //makes no sense,because other cal ap is probably running
311 // toggleBeamReceive(); 311 // toggleBeamReceive();
312 } 312 }
313 } 313 }
314#endif 314#endif
315 315
316} 316}
317bool MainWindow::beamReceiveEnabled() 317bool MainWindow::beamReceiveEnabled()
318{ 318{
319#ifndef DESKTOP_VERSION 319#ifndef DESKTOP_VERSION
320 return ( infrared != 0 ); 320 return ( infrared != 0 );
321#endif 321#endif
322 return false; 322 return false;
323} 323}
324 324
325void MainWindow::toggleBeamReceive() 325void MainWindow::toggleBeamReceive()
326{ 326{
327 if ( mBRdisabled ) 327 if ( mBRdisabled )
328 return; 328 return;
329#ifndef DESKTOP_VERSION 329#ifndef DESKTOP_VERSION
330 if ( infrared ) { 330 if ( infrared ) {
331 qDebug("disable BeamReceive "); 331 qDebug("disable BeamReceive ");
332 delete infrared; 332 delete infrared;
333 infrared = 0; 333 infrared = 0;
334 brAction->setOn(false); 334 brAction->setOn(false);
335 return; 335 return;
336 } 336 }
337 qDebug("enable BeamReceive "); 337 qDebug("enable BeamReceive ");
338 brAction->setOn(true); 338 brAction->setOn(true);
339 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 339 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 340 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
341#endif 341#endif
342} 342}
343void MainWindow::showMaximized () 343void MainWindow::showMaximized ()
344{ 344{
345#ifndef DESKTOP_VERSION 345#ifndef DESKTOP_VERSION
346 if ( ! globalFlagBlockStartup ) 346 if ( ! globalFlagBlockStartup )
347 if ( mClosed ) 347 if ( mClosed )
348 mView->goToday(); 348 mView->goToday();
349#endif 349#endif
350 QWidget::showMaximized () ; 350 QWidget::showMaximized () ;
351 mClosed = false; 351 mClosed = false;
352} 352}
353void MainWindow::closeEvent( QCloseEvent* ce ) 353void MainWindow::closeEvent( QCloseEvent* ce )
354{ 354{
355 355
356 356
357 357
358 if ( ! KOPrefs::instance()->mAskForQuit ) { 358 if ( ! KOPrefs::instance()->mAskForQuit ) {
359 saveOnClose(); 359 saveOnClose();
360 mClosed = true; 360 mClosed = true;
361 ce->accept(); 361 ce->accept();
362 return; 362 return;
363 363
364 } 364 }
365 365
366 switch( QMessageBox::information( this, "KO/Pi", 366 switch( QMessageBox::information( this, "KO/Pi",
367 i18n("Do you really want\nto close KO/Pi?"), 367 i18n("Do you really want\nto close KO/Pi?"),
368 i18n("Close"), i18n("No"), 368 i18n("Close"), i18n("No"),
369 0, 0 ) ) { 369 0, 0 ) ) {
370 case 0: 370 case 0:
371 saveOnClose(); 371 saveOnClose();
372 mClosed = true; 372 mClosed = true;
373 ce->accept(); 373 ce->accept();
374 break; 374 break;
375 case 1: 375 case 1:
376 ce->ignore(); 376 ce->ignore();
377 break; 377 break;
378 case 2: 378 case 2:
379 379
380 default: 380 default:
381 break; 381 break;
382 } 382 }
383 383
384 384
385} 385}
386 386
387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 387void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
388{ 388{
389 QDataStream stream( data, IO_ReadOnly ); 389 QDataStream stream( data, IO_ReadOnly );
390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 390 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
391 //QString datamess; 391 //QString datamess;
392 //qDebug("message "); 392 //qDebug("message ");
393 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 393 qDebug("KO: QCOP message received: %s ", cmsg.data() );
394 394
395 if ( cmsg == "setDocument(QString)" ) { 395 if ( cmsg == "setDocument(QString)" ) {
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 QString fileName; 397 QString fileName;
398 stream >> fileName; 398 stream >> fileName;
399 //qDebug("filename %s ", fileName.latin1()); 399 //qDebug("filename %s ", fileName.latin1());
400 showMaximized(); 400 showMaximized();
401 raise(); 401 raise();
402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 402 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
403 mSyncManager->slotSyncMenu( 1002 ); 403 mSyncManager->slotSyncMenu( 1002 );
404 return; 404 return;
405 } 405 }
406 406
407 if ( cmsg == "-writeFile" ) { 407 if ( cmsg == "-writeFile" ) {
408 // I made from the "-writeFile" an "-writeAlarm" 408 // I made from the "-writeFile" an "-writeAlarm"
409 mView->viewManager()->showWhatsNextView(); 409 mView->viewManager()->showWhatsNextView();
410 mCalendar->checkAlarmForIncidence( 0, true); 410 mCalendar->checkAlarmForIncidence( 0, true);