author | zautrix <zautrix> | 2005-08-23 12:55:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 12:55:50 (UTC) |
commit | 72d600e2c3b3405e5f37615a56560811c0cf9a78 (patch) (side-by-side diff) | |
tree | 0f3eeb3ae34822149ba8b6d62990725e59a29187 /korganizer/mainwindow.cpp | |
parent | e34e096c0e1b799904643c753591833f3ff2ab95 (diff) | |
download | kdepimpi-72d600e2c3b3405e5f37615a56560811c0cf9a78.zip kdepimpi-72d600e2c3b3405e5f37615a56560811c0cf9a78.tar.gz kdepimpi-72d600e2c3b3405e5f37615a56560811c0cf9a78.tar.bz2 |
kopi load change
-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 @@ -337,104 +337,126 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } } mView->saveCalendar( defaultFileName() ); 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(); delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); 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 ) ) ); mSyncManager->setDefaultFileName( sentSyncFile()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "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"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //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 updateFilterToolbar(); updateWeek( mView->startDate() ); connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( updateWeekNum( const KCal::DateList & ) ) ); mBRdisabled = false; //toggleBeamReceive(); - QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); + setCaption(i18n("Loading calendar files ... please wait" )); + QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location delete mCalendar; delete mSyncManager; #ifndef DESKTOP_VERSION if ( infrared ) delete infrared; #endif } + +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); mFocusLoop = 3; QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); } void MainWindow::slotResetFocusLoop() { --mFocusLoop; QWidget* fw = mView->viewManager()->currentView(); if ( fw ) { //qDebug("loop "); @@ -531,25 +553,30 @@ void MainWindow::closeEvent( QCloseEvent* ce ) break; case 1: ce->ignore(); break; case 2: default: break; } } - +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 ); // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); //QString datamess; //qDebug("message "); qDebug("KO: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "setDocument(QString)" ) { QDataStream stream( data, IO_ReadOnly ); QString fileName; stream >> fileName; @@ -2507,24 +2534,25 @@ void MainWindow::importFile( QString fn, bool quick ) result = QMessageBox::warning( this, "KO/Pi: Warning!", mess, "Import", "Cancel", 0, 0, 1 ); } if ( result == 0 ) { if ( mView->openCalendar( fn, true )) { KOPrefs::instance()->mLastImportFile = fn; setCaption(i18n("Imported file successfully")); } else { setCaption(i18n("Error importing file")); } + mView->updateView(); } } void MainWindow::importIcal() { QString fn =KOPrefs::instance()->mLastImportFile; fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); if ( fn == "" ) return; importFile( fn, true ); |