summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 43ee2d7..7b666d1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -123,76 +123,74 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
123 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 123 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
124 setDefaultPreferences(); 124 setDefaultPreferences();
125 mCalendar = new CalendarLocal(); 125 mCalendar = new CalendarLocal();
126 mView = new CalendarView( mCalendar, this,"mCalendar " ); 126 mView = new CalendarView( mCalendar, this,"mCalendar " );
127 mView->hide(); 127 mView->hide();
128 //mView->resize(splash->size() ); 128 //mView->resize(splash->size() );
129 initActions(); 129 initActions();
130#ifndef DESKTOP_VERSION 130#ifndef DESKTOP_VERSION
131 iconToolBar->show(); 131 iconToolBar->show();
132 qApp->processEvents(); 132 qApp->processEvents();
133#endif 133#endif
134 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 134 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
135 int vh = height() ; 135 int vh = height() ;
136 int vw = width(); 136 int vw = width();
137 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 137 //qDebug("Toolbar hei %d ",iconToolBar->height() );
138 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 138 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
139 vh -= iconToolBar->height(); 139 vh -= iconToolBar->height();
140 } else { 140 } else {
141 vw -= iconToolBar->height(); 141 vw -= iconToolBar->height();
142 } 142 }
143 //mView->setMaximumSize( splash->size() ); 143 //mView->setMaximumSize( splash->size() );
144 //mView->resize( splash->size() ); 144 //mView->resize( splash->size() );
145 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 145 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
146 mView->readSettings(); 146 mView->readSettings();
147 bool oldOpened = false;
148 bool newFile = false; 147 bool newFile = false;
149 if( !QFile::exists( defaultFileName() ) ) { 148 if( !QFile::exists( defaultFileName() ) ) {
150 QFileInfo finfo ( defaultFileName() ); 149 QFileInfo finfo ( defaultFileName() );
151 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 150 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
152 qDebug("oldfile %s ", oldFile.latin1()); 151 qDebug("oldfile %s ", oldFile.latin1());
153 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"; 152 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";
154 finfo.setFile( oldFile ); 153 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 154 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 155 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 156 mView->openCalendar( oldFile );
158 qApp->processEvents(); 157 qApp->processEvents();
159 } else { 158 } else {
160 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 159 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
161 finfo.setFile( oldFile ); 160 finfo.setFile( oldFile );
162 if (finfo.exists() ) { 161 if (finfo.exists() ) {
163 KMessageBox::information( this, message); 162 KMessageBox::information( this, message);
164 mView->openCalendar( oldFile ); 163 mView->openCalendar( oldFile );
165 qApp->processEvents(); 164 qApp->processEvents();
166 } 165 }
167 } 166 }
168 mView->saveCalendar( defaultFileName() ); 167 mView->saveCalendar( defaultFileName() );
169 newFile = true; 168 newFile = true;
170 } 169 }
171 170
172 QTime neededSaveTime = QDateTime::currentDateTime().time(); 171 QTime neededSaveTime = QDateTime::currentDateTime().time();
173 if ( ! oldOpened ) 172 mView->openCalendar( defaultFileName() );
174 mView->openCalendar( defaultFileName() );
175 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 173 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
176 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 174 qDebug("KO: Calendar loading time: %d ms",msNeeded );
177 175
178 if ( KOPrefs::instance()->mLanguageChanged ) { 176 if ( KOPrefs::instance()->mLanguageChanged ) {
179 KOPrefs::instance()->setCategoryDefaults(); 177 KOPrefs::instance()->setCategoryDefaults();
180 int count = mView->addCategories(); 178 int count = mView->addCategories();
181 KOPrefs::instance()->mLanguageChanged = false; 179 KOPrefs::instance()->mLanguageChanged = false;
182 } 180 }
183 processIncidenceSelection( 0 ); 181 processIncidenceSelection( 0 );
184 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 182 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
185 SLOT( processIncidenceSelection( Incidence * ) ) ); 183 SLOT( processIncidenceSelection( Incidence * ) ) );
186 connect( mView, SIGNAL( modifiedChanged( bool ) ), 184 connect( mView, SIGNAL( modifiedChanged( bool ) ),
187 SLOT( slotModifiedChanged( bool ) ) ); 185 SLOT( slotModifiedChanged( bool ) ) );
188 186
189 187
190 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 188 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
191 mView->setModified( false ); 189 mView->setModified( false );
192 mBlockAtStartup = false; 190 mBlockAtStartup = false;
193 mView->setModified( false ); 191 mView->setModified( false );
194 setCentralWidget( mView ); 192 setCentralWidget( mView );
195 globalFlagBlockStartup = 0; 193 globalFlagBlockStartup = 0;
196 mView->show(); 194 mView->show();
197 delete splash; 195 delete splash;
198 if ( newFile ) 196 if ( newFile )