-rw-r--r-- | korganizer/mainwindow.cpp | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9ae393d..8c72d89 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -346,27 +346,19 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : newFile = true; } - QTime neededSaveTime = QDateTime::currentDateTime().time(); - mView->loadCalendars(); - int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); - qDebug("KO: Calendar loading time: %d ms",msNeeded ); + //QTime neededSaveTime = QDateTime::currentDateTime().time(); + //mView->loadCalendars(); + //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); + //qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { KOPrefs::instance()->setAllDefaults(); } - processIncidenceSelection( 0 ); - connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), - SLOT( processIncidenceSelection( Incidence * ) ) ); - connect( mView, SIGNAL( modifiedChanged( bool ) ), - SLOT( slotModifiedChanged( bool ) ) ); connect( mView, SIGNAL( tempDisableBR(bool) ), SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); - mView->setModified( false ); - mBlockAtStartup = false; - mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); @@ -379,7 +371,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); - connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); @@ -398,9 +389,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : } //US listen for result adressed from Ka/Pi -#ifndef DESKTOP_VERSION - connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); -#endif + #ifndef DESKTOP_VERSION infrared = 0; #endif @@ -411,7 +400,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : mBRdisabled = false; //toggleBeamReceive(); - QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); + setCaption(i18n("Loading calendar files ... please wait" )); + QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); } MainWindow::~MainWindow() { @@ -426,6 +416,38 @@ MainWindow::~MainWindow() } + +void MainWindow::loadDataAfterStart() +{ + + qDebug("KO: Start loading files..." ); + QTime neededSaveTime = QDateTime::currentDateTime().time(); + mView->loadCalendars(); + int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); + qDebug("KO: Calendar loading time: %d ms",msNeeded ); + //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); + mView->setModified( false ); + mBlockAtStartup = false; + mView->setModified( false ); + connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); + processIncidenceSelection( 0 ); + connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), + SLOT( processIncidenceSelection( Incidence * ) ) ); + connect( mView, SIGNAL( modifiedChanged( bool ) ), + SLOT( slotModifiedChanged( bool ) ) ); + +#ifndef DESKTOP_VERSION + connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); + connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); + disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); + if ( !mCStringMess.isEmpty() ) + recieve( mCStringMess, mByteData ); +#endif + + + QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); +} + void MainWindow::slotResetFocus() { //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); @@ -540,7 +562,12 @@ void MainWindow::closeEvent( QCloseEvent* ce ) } - +void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) +{ + qDebug("KO: QCOP start message received: %s ", cmsg.data() ); + mCStringMess = cmsg; + mByteData = data; +} void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); @@ -2516,6 +2543,7 @@ void MainWindow::importFile( QString fn, bool quick ) } else { setCaption(i18n("Error importing file")); } + mView->updateView(); } } |