summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 30c0d2f..8daacc7 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -180,192 +180,193 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
241 mView->setModified( false ); 241 mView->setModified( false );
242 mBlockAtStartup = false; 242 mBlockAtStartup = false;
243 mView->setModified( false ); 243 mView->setModified( false );
244 setCentralWidget( mView ); 244 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 245 globalFlagBlockStartup = 0;
246 mView->show(); 246 mView->show();
247 delete splash; 247 delete splash;
248 if ( newFile ) 248 if ( newFile )
249 mView->updateConfig(); 249 mView->updateConfig();
250 // qApp->processEvents(); 250 // qApp->processEvents();
251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
252 //fillSyncMenu(); 252 //fillSyncMenu();
253 253
254 254
255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
258 mSyncManager->setDefaultFileName( defaultFileName()); 258 mSyncManager->setDefaultFileName( defaultFileName());
259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
260 mSyncManager->fillSyncMenu(); 260 mSyncManager->fillSyncMenu();
261 261
262 262
263 263
264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
265 if ( showWarning ) { 265 if ( showWarning ) {
266 KMessageBox::information( this, 266 KMessageBox::information( this,
267 "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"); 267 "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 qApp->processEvents(); 268 qApp->processEvents();
269 mView->dialogManager()->showSyncOptions(); 269 mView->dialogManager()->showSyncOptions();
270 } 270 }
271 271
272 //US listen for result adressed from Ka/Pi 272 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 273#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 275#endif
276
276} 277}
277MainWindow::~MainWindow() 278MainWindow::~MainWindow()
278{ 279{
279 //qDebug("MainWindow::~MainWindow() "); 280 //qDebug("MainWindow::~MainWindow() ");
280 //save toolbar location 281 //save toolbar location
281 delete mCalendar; 282 delete mCalendar;
282 delete mSyncManager; 283 delete mSyncManager;
283 284
284 285
285} 286}
286void MainWindow::showMaximized () 287void MainWindow::showMaximized ()
287{ 288{
288#ifndef DESKTOP_VERSION 289#ifndef DESKTOP_VERSION
289 if ( ! globalFlagBlockStartup ) 290 if ( ! globalFlagBlockStartup )
290 if ( mClosed ) 291 if ( mClosed )
291 mView->goToday(); 292 mView->goToday();
292#endif 293#endif
293 QWidget::showMaximized () ; 294 QWidget::showMaximized () ;
294 mClosed = false; 295 mClosed = false;
295} 296}
296void MainWindow::closeEvent( QCloseEvent* ce ) 297void MainWindow::closeEvent( QCloseEvent* ce )
297{ 298{
298 299
299 300
300 301
301 if ( ! KOPrefs::instance()->mAskForQuit ) { 302 if ( ! KOPrefs::instance()->mAskForQuit ) {
302 saveOnClose(); 303 saveOnClose();
303 mClosed = true; 304 mClosed = true;
304 ce->accept(); 305 ce->accept();
305 return; 306 return;
306 307
307 } 308 }
308 309
309 switch( QMessageBox::information( this, "KO/Pi", 310 switch( QMessageBox::information( this, "KO/Pi",
310 i18n("Do you really want\nto close KO/Pi?"), 311 i18n("Do you really want\nto close KO/Pi?"),
311 i18n("Close"), i18n("No"), 312 i18n("Close"), i18n("No"),
312 0, 0 ) ) { 313 0, 0 ) ) {
313 case 0: 314 case 0:
314 saveOnClose(); 315 saveOnClose();
315 mClosed = true; 316 mClosed = true;
316 ce->accept(); 317 ce->accept();
317 break; 318 break;
318 case 1: 319 case 1:
319 ce->ignore(); 320 ce->ignore();
320 break; 321 break;
321 case 2: 322 case 2:
322 323
323 default: 324 default:
324 break; 325 break;
325 } 326 }
326 327
327 328
328} 329}
329 330
330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 331void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
331{ 332{
332 QDataStream stream( data, IO_ReadOnly ); 333 QDataStream stream( data, IO_ReadOnly );
333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 334 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
334 //QString datamess; 335 //QString datamess;
335 //qDebug("message "); 336 //qDebug("message ");
336 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 337 qDebug("KO: QCOP message received: %s ", cmsg.data() );
337 338
338 if ( cmsg == "setDocument(QString)" ) { 339 if ( cmsg == "setDocument(QString)" ) {
339 QDataStream stream( data, IO_ReadOnly ); 340 QDataStream stream( data, IO_ReadOnly );
340 QString fileName; 341 QString fileName;
341 stream >> fileName; 342 stream >> fileName;
342 //qDebug("filename %s ", fileName.latin1()); 343 //qDebug("filename %s ", fileName.latin1());
343 showMaximized(); 344 showMaximized();
344 raise(); 345 raise();
345 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 346 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
346 mSyncManager->slotSyncMenu( 1002 ); 347 mSyncManager->slotSyncMenu( 1002 );
347 return; 348 return;
348 } 349 }
349 350
350 if ( cmsg == "-writeFile" ) { 351 if ( cmsg == "-writeFile" ) {
351 // I made from the "-writeFile" an "-writeAlarm" 352 // I made from the "-writeFile" an "-writeAlarm"
352 mView->viewManager()->showWhatsNextView(); 353 mView->viewManager()->showWhatsNextView();
353 mCalendar->checkAlarmForIncidence( 0, true); 354 mCalendar->checkAlarmForIncidence( 0, true);
354 showMaximized(); 355 showMaximized();
355 raise(); 356 raise();
356 return; 357 return;
357 358
358 } 359 }
359 if ( cmsg == "-writeFileSilent" ) { 360 if ( cmsg == "-writeFileSilent" ) {
360 // I made from the "-writeFile" an "-writeAlarm" 361 // I made from the "-writeFile" an "-writeAlarm"
361 // mView->viewManager()->showWhatsNextView(); 362 // mView->viewManager()->showWhatsNextView();
362 mCalendar->checkAlarmForIncidence( 0, true); 363 mCalendar->checkAlarmForIncidence( 0, true);
363 //showMaximized(); 364 //showMaximized();
364 //raise(); 365 //raise();
365 hide(); 366 hide();
366 return; 367 return;
367 } 368 }
368 if ( cmsg == "-newCountdown" ) { 369 if ( cmsg == "-newCountdown" ) {
369 qDebug("newCountdown "); 370 qDebug("newCountdown ");
370 371
371 } 372 }