author | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
commit | 2acca9aff5bd651923b5d728712a0fd80b3d54e9 (patch) (unidiff) | |
tree | c2113d441908520d86902a8a9fade08eb05ee0d0 /korganizer | |
parent | 6f5464760f5fb1e4c13027464cfe4943b85d29a0 (diff) | |
download | kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.zip kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.gz kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.bz2 |
fastload fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 8c72d89..70baf5c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -100,458 +100,459 @@ class KOex2phonePrefs : public QDialog | |||
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | QPixmap* sgListViewCompletedPix[6]; | 131 | QPixmap* sgListViewCompletedPix[6]; |
132 | QPixmap* sgListViewJournalPix; | 132 | QPixmap* sgListViewJournalPix; |
133 | 133 | ||
134 | 134 | ||
135 | int globalFlagBlockStartup; | 135 | int globalFlagBlockStartup; |
136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
137 | QMainWindow( parent, name ) | 137 | QMainWindow( parent, name ) |
138 | { | 138 | { |
139 | sgListViewCompletedPix[5] = &listviewPix; | 139 | sgListViewCompletedPix[5] = &listviewPix; |
140 | sgListViewCompletedPix[0] = &listviewPix0; | 140 | sgListViewCompletedPix[0] = &listviewPix0; |
141 | sgListViewCompletedPix[1] = &listviewPix20; | 141 | sgListViewCompletedPix[1] = &listviewPix20; |
142 | sgListViewCompletedPix[2] = &listviewPix40; | 142 | sgListViewCompletedPix[2] = &listviewPix40; |
143 | sgListViewCompletedPix[3] = &listviewPix60; | 143 | sgListViewCompletedPix[3] = &listviewPix60; |
144 | sgListViewCompletedPix[4] = &listviewPix80; | 144 | sgListViewCompletedPix[4] = &listviewPix80; |
145 | //int size = 12; | 145 | //int size = 12; |
146 | { | 146 | { |
147 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 147 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
148 | sgListViewCompletedPix[5]->fill( Qt::white ); | 148 | sgListViewCompletedPix[5]->fill( Qt::white ); |
149 | QPainter p ( sgListViewCompletedPix[5] ); | 149 | QPainter p ( sgListViewCompletedPix[5] ); |
150 | p.drawRect( 0,0,11,11); | 150 | p.drawRect( 0,0,11,11); |
151 | p.drawLine ( 2, 5, 4 , 7 ) ; | 151 | p.drawLine ( 2, 5, 4 , 7 ) ; |
152 | p.drawLine ( 4 , 7 , 8, 3) ; | 152 | p.drawLine ( 4 , 7 , 8, 3) ; |
153 | int iii = 0; | 153 | int iii = 0; |
154 | for ( iii = 0; iii < 5; ++iii ) { | 154 | for ( iii = 0; iii < 5; ++iii ) { |
155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
156 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 156 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
157 | QPainter p ( sgListViewCompletedPix[iii] ); | 157 | QPainter p ( sgListViewCompletedPix[iii] ); |
158 | p.drawRect( 0,0,11,11); | 158 | p.drawRect( 0,0,11,11); |
159 | if ( iii ) | 159 | if ( iii ) |
160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
161 | } | 161 | } |
162 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
163 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
164 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
165 | { | 165 | { |
166 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
167 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
168 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
169 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
170 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | mClosed = false; | 173 | mClosed = false; |
174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
175 | QString confFile = locateLocal("config","korganizerrc"); | 175 | QString confFile = locateLocal("config","korganizerrc"); |
176 | QFileInfo finf ( confFile ); | 176 | QFileInfo finf ( confFile ); |
177 | bool showWarning = !finf.exists(); | 177 | bool showWarning = !finf.exists(); |
178 | setIcon(SmallIcon( "ko24" ) ); | 178 | setIcon(SmallIcon( "ko24" ) ); |
179 | mBlockAtStartup = true; | 179 | mBlockAtStartup = true; |
180 | mFlagKeyPressed = false; | 180 | mFlagKeyPressed = false; |
181 | setCaption("KO/Pi"); | 181 | setCaption("KO/Pi"); |
182 | KOPrefs *p = KOPrefs::instance(); | 182 | KOPrefs *p = KOPrefs::instance(); |
183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
184 | p->mCurrentDisplayedView = 0; | 184 | p->mCurrentDisplayedView = 0; |
185 | if ( p->mHourSize > 22 ) | 185 | if ( p->mHourSize > 22 ) |
186 | p->mHourSize = 22; | 186 | p->mHourSize = 22; |
187 | QMainWindow::ToolBarDock tbd; | 187 | QMainWindow::ToolBarDock tbd; |
188 | if ( p->mToolBarHor ) { | 188 | if ( p->mToolBarHor ) { |
189 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
190 | tbd = Bottom; | 190 | tbd = Bottom; |
191 | else | 191 | else |
192 | tbd = Top; | 192 | tbd = Top; |
193 | } | 193 | } |
194 | else { | 194 | else { |
195 | if ( p->mToolBarUp ) | 195 | if ( p->mToolBarUp ) |
196 | tbd = Right; | 196 | tbd = Right; |
197 | else | 197 | else |
198 | tbd = Left; | 198 | tbd = Left; |
199 | } | 199 | } |
200 | if ( KOPrefs::instance()->mUseAppColors ) | 200 | if ( KOPrefs::instance()->mUseAppColors ) |
201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
202 | globalFlagBlockStartup = 1; | 202 | globalFlagBlockStartup = 1; |
203 | iconToolBar = new QPEToolBar( this ); | 203 | iconToolBar = new QPEToolBar( this ); |
204 | addToolBar (iconToolBar , tbd ); | 204 | addToolBar (iconToolBar , tbd ); |
205 | 205 | ||
206 | #ifdef DESKTOP_VERSION | 206 | #ifdef DESKTOP_VERSION |
207 | if ( KOPrefs::instance()->mShowIconFilter ) | 207 | if ( KOPrefs::instance()->mShowIconFilter ) |
208 | #else | 208 | #else |
209 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) | 209 | if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | { | 212 | { |
213 | if ( p->mToolBarHorF ) { | 213 | if ( p->mToolBarHorF ) { |
214 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
215 | tbd = Bottom; | 215 | tbd = Bottom; |
216 | else | 216 | else |
217 | tbd = Top; | 217 | tbd = Top; |
218 | } | 218 | } |
219 | else { | 219 | else { |
220 | if ( p->mToolBarUpF ) | 220 | if ( p->mToolBarUpF ) |
221 | tbd = Right; | 221 | tbd = Right; |
222 | else | 222 | else |
223 | tbd = Left; | 223 | tbd = Left; |
224 | } | 224 | } |
225 | filterToolBar = new QPEToolBar ( this ); | 225 | filterToolBar = new QPEToolBar ( this ); |
226 | filterMenubar = new KMenuBar( 0 ); | 226 | filterMenubar = new KMenuBar( 0 ); |
227 | QFontMetrics fm ( filterMenubar->font() ); | 227 | QFontMetrics fm ( filterMenubar->font() ); |
228 | #ifndef DESKTOP_VERSION | 228 | #ifndef DESKTOP_VERSION |
229 | filterToolBar->setFocusPolicy( NoFocus ); | 229 | filterToolBar->setFocusPolicy( NoFocus ); |
230 | filterMenubar->setFocusPolicy( NoFocus ); | 230 | filterMenubar->setFocusPolicy( NoFocus ); |
231 | #endif | 231 | #endif |
232 | filterPopupMenu = new QPopupMenu( this ); | 232 | filterPopupMenu = new QPopupMenu( this ); |
233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 233 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
234 | QString addTest = "A"; | 234 | QString addTest = "A"; |
235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 235 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
236 | #ifdef DESKTOP_VERSION | 236 | #ifdef DESKTOP_VERSION |
237 | addTest = "AAAAAABBBCCCx"; | 237 | addTest = "AAAAAABBBCCCx"; |
238 | #else | 238 | #else |
239 | addTest = "AAAAAx"; | 239 | addTest = "AAAAAx"; |
240 | #endif | 240 | #endif |
241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 241 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
242 | addToolBar (filterToolBar , tbd ); | 242 | addToolBar (filterToolBar , tbd ); |
243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 243 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
246 | filterToolBar->hide(); | 246 | filterToolBar->hide(); |
247 | } else { | 247 | } else { |
248 | filterToolBar = 0; | 248 | filterToolBar = 0; |
249 | filterMenubar = 0; | 249 | filterMenubar = 0; |
250 | filterPopupMenu = 0; | 250 | filterPopupMenu = 0; |
251 | } | 251 | } |
252 | if ( p->mShowIconOnetoolbar ) { | 252 | if ( p->mShowIconOnetoolbar ) { |
253 | viewToolBar = iconToolBar ; | 253 | viewToolBar = iconToolBar ; |
254 | navigatorToolBar = iconToolBar ; | 254 | navigatorToolBar = iconToolBar ; |
255 | } else { | 255 | } else { |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | setToolBarsMovable( false ); | 257 | setToolBarsMovable( false ); |
258 | #endif | 258 | #endif |
259 | if ( p->mToolBarHorV ) { | 259 | if ( p->mToolBarHorV ) { |
260 | if ( p->mToolBarUpV ) | 260 | if ( p->mToolBarUpV ) |
261 | tbd = Bottom; | 261 | tbd = Bottom; |
262 | else | 262 | else |
263 | tbd = Top; | 263 | tbd = Top; |
264 | } | 264 | } |
265 | else { | 265 | else { |
266 | if ( p->mToolBarUpV ) | 266 | if ( p->mToolBarUpV ) |
267 | tbd = Right; | 267 | tbd = Right; |
268 | else | 268 | else |
269 | tbd = Left; | 269 | tbd = Left; |
270 | } | 270 | } |
271 | viewToolBar = new QPEToolBar( this ); | 271 | viewToolBar = new QPEToolBar( this ); |
272 | addToolBar (viewToolBar , tbd ); | 272 | addToolBar (viewToolBar , tbd ); |
273 | if ( p->mToolBarHorN ) { | 273 | if ( p->mToolBarHorN ) { |
274 | if ( p->mToolBarUpN ) | 274 | if ( p->mToolBarUpN ) |
275 | tbd = Bottom; | 275 | tbd = Bottom; |
276 | else | 276 | else |
277 | tbd = Top; | 277 | tbd = Top; |
278 | } | 278 | } |
279 | else { | 279 | else { |
280 | if ( p->mToolBarUpN ) | 280 | if ( p->mToolBarUpN ) |
281 | tbd = Right; | 281 | tbd = Right; |
282 | else | 282 | else |
283 | tbd = Left; | 283 | tbd = Left; |
284 | } | 284 | } |
285 | navigatorToolBar = new QPEToolBar( this ); | 285 | navigatorToolBar = new QPEToolBar( this ); |
286 | addToolBar (navigatorToolBar , tbd ); | 286 | addToolBar (navigatorToolBar , tbd ); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | mCalendarModifiedFlag = false; | 291 | mCalendarModifiedFlag = false; |
292 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 292 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
293 | splash->setAlignment ( AlignCenter ); | 293 | //splash->setAlignment ( AlignCenter ); |
294 | setCentralWidget( splash ); | 294 | //setCentralWidget( splash ); |
295 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
296 | showMaximized(); | 296 | //showMaximized(); |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
300 | setDefaultPreferences(); | 300 | setDefaultPreferences(); |
301 | mCalendar = new CalendarLocal(); | 301 | mCalendar = new CalendarLocal(); |
302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
303 | mView->hide(); | 303 | setCentralWidget( mView ); |
304 | //mView->hide(); | ||
304 | //mView->resize(splash->size() ); | 305 | //mView->resize(splash->size() ); |
305 | initActions(); | 306 | initActions(); |
306 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 307 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
307 | mSyncManager->setBlockSave(false); | 308 | mSyncManager->setBlockSave(false); |
308 | mView->setSyncManager(mSyncManager); | 309 | mView->setSyncManager(mSyncManager); |
309 | #ifndef DESKTOP_VERSION | 310 | #ifndef DESKTOP_VERSION |
310 | iconToolBar->show(); | 311 | iconToolBar->show(); |
311 | qApp->processEvents(); | 312 | qApp->processEvents(); |
312 | #endif | 313 | #endif |
313 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 314 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
314 | int vh = height() ; | 315 | int vh = height() ; |
315 | int vw = width(); | 316 | int vw = width(); |
316 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 317 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
317 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
318 | vh -= iconToolBar->height(); | 319 | vh -= iconToolBar->height(); |
319 | } else { | 320 | } else { |
320 | vw -= iconToolBar->height(); | 321 | vw -= iconToolBar->height(); |
321 | } | 322 | } |
322 | //mView->setMaximumSize( splash->size() ); | 323 | //mView->setMaximumSize( splash->size() ); |
323 | //mView->resize( splash->size() ); | 324 | //mView->resize( splash->size() ); |
324 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
325 | mView->readSettings(); | 326 | mView->readSettings(); |
326 | bool newFile = false; | 327 | bool newFile = false; |
327 | if( !QFile::exists( defaultFileName() ) ) { | 328 | if( !QFile::exists( defaultFileName() ) ) { |
328 | QFileInfo finfo ( defaultFileName() ); | 329 | QFileInfo finfo ( defaultFileName() ); |
329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 330 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
330 | 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"; | 331 | 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"; |
331 | finfo.setFile( oldFile ); | 332 | finfo.setFile( oldFile ); |
332 | if (finfo.exists() ) { | 333 | if (finfo.exists() ) { |
333 | KMessageBox::information( this, message); | 334 | KMessageBox::information( this, message); |
334 | mView->openCalendar( oldFile ); | 335 | mView->openCalendar( oldFile ); |
335 | qApp->processEvents(); | 336 | qApp->processEvents(); |
336 | } else { | 337 | } else { |
337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 338 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
338 | finfo.setFile( oldFile ); | 339 | finfo.setFile( oldFile ); |
339 | if (finfo.exists() ) { | 340 | if (finfo.exists() ) { |
340 | KMessageBox::information( this, message); | 341 | KMessageBox::information( this, message); |
341 | mView->openCalendar( oldFile ); | 342 | mView->openCalendar( oldFile ); |
342 | qApp->processEvents(); | 343 | qApp->processEvents(); |
343 | } | 344 | } |
344 | } | 345 | } |
345 | mView->saveCalendar( defaultFileName() ); | 346 | mView->saveCalendar( defaultFileName() ); |
346 | newFile = true; | 347 | newFile = true; |
347 | } | 348 | } |
348 | 349 | ||
349 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); | 350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
350 | //mView->loadCalendars(); | 351 | //mView->loadCalendars(); |
351 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
352 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
353 | 354 | ||
354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
355 | KOPrefs::instance()->setAllDefaults(); | 356 | KOPrefs::instance()->setAllDefaults(); |
356 | } | 357 | } |
357 | 358 | ||
358 | 359 | ||
359 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 360 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
360 | SLOT( disableBR(bool) ) ); | 361 | SLOT( disableBR(bool) ) ); |
361 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
362 | setCentralWidget( mView ); | 363 | setCentralWidget( mView ); |
363 | globalFlagBlockStartup = 0; | 364 | globalFlagBlockStartup = 0; |
364 | mView->show(); | 365 | //mView->show(); |
365 | delete splash; | 366 | //delete splash; |
366 | if ( newFile ) | 367 | if ( newFile ) |
367 | mView->updateConfig(); | 368 | mView->updateConfig(); |
368 | // qApp->processEvents(); | 369 | // qApp->processEvents(); |
369 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
370 | //fillSyncMenu(); | 371 | //fillSyncMenu(); |
371 | 372 | ||
372 | 373 | ||
373 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
374 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
375 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
376 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
377 | mSyncManager->setDefaultFileName( sentSyncFile()); | 378 | mSyncManager->setDefaultFileName( sentSyncFile()); |
378 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
379 | mSyncManager->fillSyncMenu(); | 380 | mSyncManager->fillSyncMenu(); |
380 | 381 | ||
381 | 382 | ||
382 | 383 | ||
383 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
384 | if ( showWarning ) { | 385 | if ( showWarning ) { |
385 | KMessageBox::information( this, | 386 | KMessageBox::information( this, |
386 | "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"); | 387 | "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"); |
387 | qApp->processEvents(); | 388 | qApp->processEvents(); |
388 | mView->dialogManager()->showSyncOptions(); | 389 | mView->dialogManager()->showSyncOptions(); |
389 | } | 390 | } |
390 | 391 | ||
391 | //US listen for result adressed from Ka/Pi | 392 | //US listen for result adressed from Ka/Pi |
392 | 393 | ||
393 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
394 | infrared = 0; | 395 | infrared = 0; |
395 | #endif | 396 | #endif |
396 | updateFilterToolbar(); | 397 | updateFilterToolbar(); |
397 | updateWeek( mView->startDate() ); | 398 | updateWeek( mView->startDate() ); |
398 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
399 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
400 | mBRdisabled = false; | 401 | mBRdisabled = false; |
401 | //toggleBeamReceive(); | 402 | //toggleBeamReceive(); |
402 | 403 | ||
403 | setCaption(i18n("Loading calendar files ... please wait" )); | 404 | setCaption(i18n("Loading calendar files ... please wait" )); |
404 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); | 405 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); |
405 | } | 406 | } |
406 | MainWindow::~MainWindow() | 407 | MainWindow::~MainWindow() |
407 | { | 408 | { |
408 | //qDebug("MainWindow::~MainWindow() "); | 409 | //qDebug("MainWindow::~MainWindow() "); |
409 | //save toolbar location | 410 | //save toolbar location |
410 | delete mCalendar; | 411 | delete mCalendar; |
411 | delete mSyncManager; | 412 | delete mSyncManager; |
412 | #ifndef DESKTOP_VERSION | 413 | #ifndef DESKTOP_VERSION |
413 | if ( infrared ) | 414 | if ( infrared ) |
414 | delete infrared; | 415 | delete infrared; |
415 | #endif | 416 | #endif |
416 | 417 | ||
417 | 418 | ||
418 | } | 419 | } |
419 | 420 | ||
420 | void MainWindow::loadDataAfterStart() | 421 | void MainWindow::loadDataAfterStart() |
421 | { | 422 | { |
422 | 423 | ||
423 | qDebug("KO: Start loading files..." ); | 424 | qDebug("KO: Start loading files..." ); |
424 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 425 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
425 | mView->loadCalendars(); | 426 | mView->loadCalendars(); |
426 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 427 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
427 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 428 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
428 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 429 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
429 | mView->setModified( false ); | 430 | mView->setModified( false ); |
430 | mBlockAtStartup = false; | 431 | mBlockAtStartup = false; |
431 | mView->setModified( false ); | 432 | mView->setModified( false ); |
432 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
433 | processIncidenceSelection( 0 ); | 434 | processIncidenceSelection( 0 ); |
434 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
435 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 436 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
436 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
437 | SLOT( slotModifiedChanged( bool ) ) ); | 438 | SLOT( slotModifiedChanged( bool ) ) ); |
438 | 439 | ||
439 | #ifndef DESKTOP_VERSION | 440 | #ifndef DESKTOP_VERSION |
440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 441 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | 442 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); |
442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | 443 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
443 | if ( !mCStringMess.isEmpty() ) | 444 | if ( !mCStringMess.isEmpty() ) |
444 | recieve( mCStringMess, mByteData ); | 445 | recieve( mCStringMess, mByteData ); |
445 | #endif | 446 | #endif |
446 | 447 | ||
447 | 448 | ||
448 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 449 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
449 | } | 450 | } |
450 | 451 | ||
451 | void MainWindow::slotResetFocus() | 452 | void MainWindow::slotResetFocus() |
452 | { | 453 | { |
453 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 454 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
454 | mFocusLoop = 3; | 455 | mFocusLoop = 3; |
455 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 456 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
456 | } | 457 | } |
457 | void MainWindow::slotResetFocusLoop() | 458 | void MainWindow::slotResetFocusLoop() |
458 | { | 459 | { |
459 | --mFocusLoop; | 460 | --mFocusLoop; |
460 | QWidget* fw = mView->viewManager()->currentView(); | 461 | QWidget* fw = mView->viewManager()->currentView(); |
461 | if ( fw ) { | 462 | if ( fw ) { |
462 | //qDebug("loop "); | 463 | //qDebug("loop "); |
463 | fw->setFocus(); | 464 | fw->setFocus(); |
464 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 465 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
465 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 466 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
466 | } | 467 | } |
467 | 468 | ||
468 | } | 469 | } |
469 | void MainWindow::disableBR(bool b) | 470 | void MainWindow::disableBR(bool b) |
470 | { | 471 | { |
471 | #ifndef DESKTOP_VERSION | 472 | #ifndef DESKTOP_VERSION |
472 | if ( b ) { | 473 | if ( b ) { |
473 | if ( infrared ) { | 474 | if ( infrared ) { |
474 | toggleBeamReceive(); | 475 | toggleBeamReceive(); |
475 | mBRdisabled = true; | 476 | mBRdisabled = true; |
476 | } | 477 | } |
477 | mBRdisabled = true; | 478 | mBRdisabled = true; |
478 | } else { | 479 | } else { |
479 | if ( mBRdisabled ) { | 480 | if ( mBRdisabled ) { |
480 | mBRdisabled = false; | 481 | mBRdisabled = false; |
481 | //makes no sense,because other cal ap is probably running | 482 | //makes no sense,because other cal ap is probably running |
482 | // toggleBeamReceive(); | 483 | // toggleBeamReceive(); |
483 | } | 484 | } |
484 | } | 485 | } |
485 | #endif | 486 | #endif |
486 | 487 | ||
487 | } | 488 | } |
488 | bool MainWindow::beamReceiveEnabled() | 489 | bool MainWindow::beamReceiveEnabled() |
489 | { | 490 | { |
490 | #ifndef DESKTOP_VERSION | 491 | #ifndef DESKTOP_VERSION |
491 | return ( infrared != 0 ); | 492 | return ( infrared != 0 ); |
492 | #endif | 493 | #endif |
493 | return false; | 494 | return false; |
494 | } | 495 | } |
495 | 496 | ||
496 | void MainWindow::toggleBeamReceive() | 497 | void MainWindow::toggleBeamReceive() |
497 | { | 498 | { |
498 | if ( mBRdisabled ) | 499 | if ( mBRdisabled ) |
499 | return; | 500 | return; |
500 | #ifndef DESKTOP_VERSION | 501 | #ifndef DESKTOP_VERSION |
501 | if ( infrared ) { | 502 | if ( infrared ) { |
502 | qDebug("KO: Disable BeamReceive "); | 503 | qDebug("KO: Disable BeamReceive "); |
503 | delete infrared; | 504 | delete infrared; |
504 | infrared = 0; | 505 | infrared = 0; |
505 | brAction->setOn(false); | 506 | brAction->setOn(false); |
506 | return; | 507 | return; |
507 | } | 508 | } |
508 | qDebug("KO: Enable BeamReceive "); | 509 | qDebug("KO: Enable BeamReceive "); |
509 | brAction->setOn(true); | 510 | brAction->setOn(true); |
510 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 511 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
511 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 512 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
512 | #endif | 513 | #endif |
513 | } | 514 | } |
514 | void MainWindow::showMaximized () | 515 | void MainWindow::showMaximized () |
515 | { | 516 | { |
516 | #ifndef DESKTOP_VERSION | 517 | #ifndef DESKTOP_VERSION |
517 | if ( ! globalFlagBlockStartup ) | 518 | if ( ! globalFlagBlockStartup ) |
518 | if ( mClosed ) | 519 | if ( mClosed ) |
519 | mView->goToday(); | 520 | mView->goToday(); |
520 | #endif | 521 | #endif |
521 | QWidget::showMaximized () ; | 522 | QWidget::showMaximized () ; |
522 | mClosed = false; | 523 | mClosed = false; |
523 | } | 524 | } |
524 | void MainWindow::closeEvent( QCloseEvent* ce ) | 525 | void MainWindow::closeEvent( QCloseEvent* ce ) |
525 | { | 526 | { |
526 | 527 | ||
527 | 528 | ||
528 | 529 | ||
529 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 530 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
530 | saveOnClose(); | 531 | saveOnClose(); |
531 | if ( mCalendarModifiedFlag ) { | 532 | if ( mCalendarModifiedFlag ) { |
532 | ce->ignore(); | 533 | ce->ignore(); |
533 | return; | 534 | return; |
534 | } | 535 | } |
535 | mClosed = true; | 536 | mClosed = true; |
536 | ce->accept(); | 537 | ce->accept(); |
537 | return; | 538 | return; |
538 | 539 | ||
539 | } | 540 | } |
540 | 541 | ||
541 | switch( QMessageBox::information( this, "KO/Pi", | 542 | switch( QMessageBox::information( this, "KO/Pi", |
542 | i18n("Do you really want\nto close KO/Pi?"), | 543 | i18n("Do you really want\nto close KO/Pi?"), |
543 | i18n("Close"), i18n("No"), | 544 | i18n("Close"), i18n("No"), |
544 | 0, 0 ) ) { | 545 | 0, 0 ) ) { |
545 | case 0: | 546 | case 0: |
546 | saveOnClose(); | 547 | saveOnClose(); |
547 | if ( mCalendarModifiedFlag ) { | 548 | if ( mCalendarModifiedFlag ) { |
548 | ce->ignore(); | 549 | ce->ignore(); |
549 | return; | 550 | return; |
550 | } | 551 | } |
551 | mClosed = true; | 552 | mClosed = true; |
552 | ce->accept(); | 553 | ce->accept(); |
553 | break; | 554 | break; |
554 | case 1: | 555 | case 1: |
555 | ce->ignore(); | 556 | ce->ignore(); |
556 | break; | 557 | break; |
557 | case 2: | 558 | case 2: |