author | zautrix <zautrix> | 2005-03-30 00:57:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 00:57:42 (UTC) |
commit | 889d2102fcfe2fb0786b3f8f406dc32b42e38c7a (patch) (unidiff) | |
tree | 32b269c1140a5646a00b65c78ac71116adb91aa1 | |
parent | 99324133d35ba588b688bc5b22788fd8fb9e752d (diff) | |
download | kdepimpi-889d2102fcfe2fb0786b3f8f406dc32b42e38c7a.zip kdepimpi-889d2102fcfe2fb0786b3f8f406dc32b42e38c7a.tar.gz kdepimpi-889d2102fcfe2fb0786b3f8f406dc32b42e38c7a.tar.bz2 |
fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 67 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 4 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 13 |
3 files changed, 71 insertions, 13 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6ddced0..ae03a09 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -135,1167 +135,1171 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
135 | { | 135 | { |
136 | 136 | ||
137 | mClosed = false; | 137 | mClosed = false; |
138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
139 | QString confFile = locateLocal("config","korganizerrc"); | 139 | QString confFile = locateLocal("config","korganizerrc"); |
140 | QFileInfo finf ( confFile ); | 140 | QFileInfo finf ( confFile ); |
141 | bool showWarning = !finf.exists(); | 141 | bool showWarning = !finf.exists(); |
142 | setIcon(SmallIcon( "ko24" ) ); | 142 | setIcon(SmallIcon( "ko24" ) ); |
143 | mBlockAtStartup = true; | 143 | mBlockAtStartup = true; |
144 | mFlagKeyPressed = false; | 144 | mFlagKeyPressed = false; |
145 | setCaption("KO/Pi"); | 145 | setCaption("KO/Pi"); |
146 | KOPrefs *p = KOPrefs::instance(); | 146 | KOPrefs *p = KOPrefs::instance(); |
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 147 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
148 | if ( p->mHourSize > 22 ) | 148 | if ( p->mHourSize > 22 ) |
149 | p->mHourSize = 22; | 149 | p->mHourSize = 22; |
150 | QMainWindow::ToolBarDock tbd; | 150 | QMainWindow::ToolBarDock tbd; |
151 | if ( p->mToolBarHor ) { | 151 | if ( p->mToolBarHor ) { |
152 | if ( p->mToolBarUp ) | 152 | if ( p->mToolBarUp ) |
153 | tbd = Bottom; | 153 | tbd = Bottom; |
154 | else | 154 | else |
155 | tbd = Top; | 155 | tbd = Top; |
156 | } | 156 | } |
157 | else { | 157 | else { |
158 | if ( p->mToolBarUp ) | 158 | if ( p->mToolBarUp ) |
159 | tbd = Right; | 159 | tbd = Right; |
160 | else | 160 | else |
161 | tbd = Left; | 161 | tbd = Left; |
162 | } | 162 | } |
163 | if ( KOPrefs::instance()->mUseAppColors ) | 163 | if ( KOPrefs::instance()->mUseAppColors ) |
164 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 164 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
165 | globalFlagBlockStartup = 1; | 165 | globalFlagBlockStartup = 1; |
166 | iconToolBar = new QPEToolBar( this ); | 166 | iconToolBar = new QPEToolBar( this ); |
167 | addToolBar (iconToolBar , tbd ); | 167 | addToolBar (iconToolBar , tbd ); |
168 | 168 | ||
169 | if ( KOPrefs::instance()->mShowIconFilter ) { | 169 | if ( KOPrefs::instance()->mShowIconFilter ) { |
170 | if ( p->mToolBarHorF ) { | 170 | if ( p->mToolBarHorF ) { |
171 | if ( p->mToolBarUpF ) | 171 | if ( p->mToolBarUpF ) |
172 | tbd = Bottom; | 172 | tbd = Bottom; |
173 | else | 173 | else |
174 | tbd = Top; | 174 | tbd = Top; |
175 | } | 175 | } |
176 | else { | 176 | else { |
177 | if ( p->mToolBarUpF ) | 177 | if ( p->mToolBarUpF ) |
178 | tbd = Right; | 178 | tbd = Right; |
179 | else | 179 | else |
180 | tbd = Left; | 180 | tbd = Left; |
181 | } | 181 | } |
182 | filterToolBar = new QPEToolBar ( this ); | 182 | filterToolBar = new QPEToolBar ( this ); |
183 | filterMenubar = new QPEMenuBar( filterToolBar ); | 183 | filterMenubar = new QPEMenuBar( filterToolBar ); |
184 | QFontMetrics fm ( filterMenubar->font() ); | 184 | QFontMetrics fm ( filterMenubar->font() ); |
185 | 185 | ||
186 | filterPopupMenu = new QPopupMenu( this ); | 186 | filterPopupMenu = new QPopupMenu( this ); |
187 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 187 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
188 | QString addTest = "Ax"; | 188 | QString addTest = "Ax"; |
189 | #ifdef DESKTOP_VERSION | 189 | #ifdef DESKTOP_VERSION |
190 | addTest = "AAAx"; | 190 | addTest = "AAAx"; |
191 | #endif | 191 | #endif |
192 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); | 192 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); |
193 | addToolBar (filterToolBar , tbd ); | 193 | addToolBar (filterToolBar , tbd ); |
194 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 194 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
195 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 195 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
196 | } else { | 196 | } else { |
197 | filterToolBar = 0; | 197 | filterToolBar = 0; |
198 | filterMenubar = 0; | 198 | filterMenubar = 0; |
199 | filterPopupMenu = 0; | 199 | filterPopupMenu = 0; |
200 | } | 200 | } |
201 | if ( p->mShowIconOnetoolbar ) { | 201 | if ( p->mShowIconOnetoolbar ) { |
202 | viewToolBar = iconToolBar ; | 202 | viewToolBar = iconToolBar ; |
203 | navigatorToolBar = iconToolBar ; | 203 | navigatorToolBar = iconToolBar ; |
204 | } else { | 204 | } else { |
205 | if ( p->mToolBarHorV ) { | 205 | if ( p->mToolBarHorV ) { |
206 | if ( p->mToolBarUpV ) | 206 | if ( p->mToolBarUpV ) |
207 | tbd = Bottom; | 207 | tbd = Bottom; |
208 | else | 208 | else |
209 | tbd = Top; | 209 | tbd = Top; |
210 | } | 210 | } |
211 | else { | 211 | else { |
212 | if ( p->mToolBarUpV ) | 212 | if ( p->mToolBarUpV ) |
213 | tbd = Right; | 213 | tbd = Right; |
214 | else | 214 | else |
215 | tbd = Left; | 215 | tbd = Left; |
216 | } | 216 | } |
217 | viewToolBar = new QPEToolBar( this ); | 217 | viewToolBar = new QPEToolBar( this ); |
218 | addToolBar (viewToolBar , tbd ); | 218 | addToolBar (viewToolBar , tbd ); |
219 | if ( p->mToolBarHorN ) { | 219 | if ( p->mToolBarHorN ) { |
220 | if ( p->mToolBarUpN ) | 220 | if ( p->mToolBarUpN ) |
221 | tbd = Bottom; | 221 | tbd = Bottom; |
222 | else | 222 | else |
223 | tbd = Top; | 223 | tbd = Top; |
224 | } | 224 | } |
225 | else { | 225 | else { |
226 | if ( p->mToolBarUpN ) | 226 | if ( p->mToolBarUpN ) |
227 | tbd = Right; | 227 | tbd = Right; |
228 | else | 228 | else |
229 | tbd = Left; | 229 | tbd = Left; |
230 | } | 230 | } |
231 | navigatorToolBar = new QPEToolBar( this ); | 231 | navigatorToolBar = new QPEToolBar( this ); |
232 | addToolBar (navigatorToolBar , tbd ); | 232 | addToolBar (navigatorToolBar , tbd ); |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | 236 | ||
237 | mCalendarModifiedFlag = false; | 237 | mCalendarModifiedFlag = false; |
238 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 238 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
239 | splash->setAlignment ( AlignCenter ); | 239 | splash->setAlignment ( AlignCenter ); |
240 | setCentralWidget( splash ); | 240 | setCentralWidget( splash ); |
241 | #ifndef DESKTOP_VERSION | 241 | #ifndef DESKTOP_VERSION |
242 | showMaximized(); | 242 | showMaximized(); |
243 | #endif | 243 | #endif |
244 | 244 | ||
245 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 245 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
246 | setDefaultPreferences(); | 246 | setDefaultPreferences(); |
247 | mCalendar = new CalendarLocal(); | 247 | mCalendar = new CalendarLocal(); |
248 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 248 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
249 | mView->hide(); | 249 | mView->hide(); |
250 | //mView->resize(splash->size() ); | 250 | //mView->resize(splash->size() ); |
251 | initActions(); | 251 | initActions(); |
252 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 252 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
253 | mSyncManager->setBlockSave(false); | 253 | mSyncManager->setBlockSave(false); |
254 | mView->setSyncManager(mSyncManager); | 254 | mView->setSyncManager(mSyncManager); |
255 | #ifndef DESKTOP_VERSION | 255 | #ifndef DESKTOP_VERSION |
256 | iconToolBar->show(); | 256 | iconToolBar->show(); |
257 | qApp->processEvents(); | 257 | qApp->processEvents(); |
258 | #endif | 258 | #endif |
259 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 259 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
260 | int vh = height() ; | 260 | int vh = height() ; |
261 | int vw = width(); | 261 | int vw = width(); |
262 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 262 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
263 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 263 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
264 | vh -= iconToolBar->height(); | 264 | vh -= iconToolBar->height(); |
265 | } else { | 265 | } else { |
266 | vw -= iconToolBar->height(); | 266 | vw -= iconToolBar->height(); |
267 | } | 267 | } |
268 | //mView->setMaximumSize( splash->size() ); | 268 | //mView->setMaximumSize( splash->size() ); |
269 | //mView->resize( splash->size() ); | 269 | //mView->resize( splash->size() ); |
270 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 270 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
271 | mView->readSettings(); | 271 | mView->readSettings(); |
272 | bool newFile = false; | 272 | bool newFile = false; |
273 | if( !QFile::exists( defaultFileName() ) ) { | 273 | if( !QFile::exists( defaultFileName() ) ) { |
274 | QFileInfo finfo ( defaultFileName() ); | 274 | QFileInfo finfo ( defaultFileName() ); |
275 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 275 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
276 | qDebug("oldfile %s ", oldFile.latin1()); | 276 | qDebug("oldfile %s ", oldFile.latin1()); |
277 | 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"; | 277 | 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"; |
278 | finfo.setFile( oldFile ); | 278 | finfo.setFile( oldFile ); |
279 | if (finfo.exists() ) { | 279 | if (finfo.exists() ) { |
280 | KMessageBox::information( this, message); | 280 | KMessageBox::information( this, message); |
281 | mView->openCalendar( oldFile ); | 281 | mView->openCalendar( oldFile ); |
282 | qApp->processEvents(); | 282 | qApp->processEvents(); |
283 | } else { | 283 | } else { |
284 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 284 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
285 | finfo.setFile( oldFile ); | 285 | finfo.setFile( oldFile ); |
286 | if (finfo.exists() ) { | 286 | if (finfo.exists() ) { |
287 | KMessageBox::information( this, message); | 287 | KMessageBox::information( this, message); |
288 | mView->openCalendar( oldFile ); | 288 | mView->openCalendar( oldFile ); |
289 | qApp->processEvents(); | 289 | qApp->processEvents(); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | mView->saveCalendar( defaultFileName() ); | 292 | mView->saveCalendar( defaultFileName() ); |
293 | newFile = true; | 293 | newFile = true; |
294 | } | 294 | } |
295 | 295 | ||
296 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 296 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
297 | mView->openCalendar( defaultFileName() ); | 297 | mView->openCalendar( defaultFileName() ); |
298 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 298 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
299 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 299 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
300 | 300 | ||
301 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 301 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
302 | KOPrefs::instance()->setAllDefaults(); | 302 | KOPrefs::instance()->setAllDefaults(); |
303 | int count = mView->addCategories(); | 303 | int count = mView->addCategories(); |
304 | } | 304 | } |
305 | processIncidenceSelection( 0 ); | 305 | processIncidenceSelection( 0 ); |
306 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 306 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
307 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 307 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
308 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 308 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
309 | SLOT( slotModifiedChanged( bool ) ) ); | 309 | SLOT( slotModifiedChanged( bool ) ) ); |
310 | 310 | ||
311 | 311 | ||
312 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 312 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
313 | SLOT( disableBR(bool) ) ); | 313 | SLOT( disableBR(bool) ) ); |
314 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 314 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
315 | mView->setModified( false ); | 315 | mView->setModified( false ); |
316 | mBlockAtStartup = false; | 316 | mBlockAtStartup = false; |
317 | mView->setModified( false ); | 317 | mView->setModified( false ); |
318 | setCentralWidget( mView ); | 318 | setCentralWidget( mView ); |
319 | globalFlagBlockStartup = 0; | 319 | globalFlagBlockStartup = 0; |
320 | mView->show(); | 320 | mView->show(); |
321 | delete splash; | 321 | delete splash; |
322 | if ( newFile ) | 322 | if ( newFile ) |
323 | mView->updateConfig(); | 323 | mView->updateConfig(); |
324 | // qApp->processEvents(); | 324 | // qApp->processEvents(); |
325 | //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 ()); |
326 | //fillSyncMenu(); | 326 | //fillSyncMenu(); |
327 | 327 | ||
328 | 328 | ||
329 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 329 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
330 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 330 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
331 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 331 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
332 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 332 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
333 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 333 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
334 | mSyncManager->setDefaultFileName( sentSyncFile()); | 334 | mSyncManager->setDefaultFileName( sentSyncFile()); |
335 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 335 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
336 | mSyncManager->fillSyncMenu(); | 336 | mSyncManager->fillSyncMenu(); |
337 | 337 | ||
338 | 338 | ||
339 | 339 | ||
340 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 340 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
341 | if ( showWarning ) { | 341 | if ( showWarning ) { |
342 | KMessageBox::information( this, | 342 | KMessageBox::information( this, |
343 | "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"); | 343 | "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"); |
344 | qApp->processEvents(); | 344 | qApp->processEvents(); |
345 | mView->dialogManager()->showSyncOptions(); | 345 | mView->dialogManager()->showSyncOptions(); |
346 | } | 346 | } |
347 | 347 | ||
348 | //US listen for result adressed from Ka/Pi | 348 | //US listen for result adressed from Ka/Pi |
349 | #ifndef DESKTOP_VERSION | 349 | #ifndef DESKTOP_VERSION |
350 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 350 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
351 | #endif | 351 | #endif |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | infrared = 0; | 353 | infrared = 0; |
354 | #endif | 354 | #endif |
355 | updateFilterToolbar(); | 355 | updateFilterToolbar(); |
356 | updateWeek( mView->startDate() ); | 356 | updateWeek( mView->startDate() ); |
357 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 357 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
358 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 358 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
359 | mBRdisabled = false; | 359 | mBRdisabled = false; |
360 | //toggleBeamReceive(); | 360 | //toggleBeamReceive(); |
361 | } | 361 | } |
362 | MainWindow::~MainWindow() | 362 | MainWindow::~MainWindow() |
363 | { | 363 | { |
364 | //qDebug("MainWindow::~MainWindow() "); | 364 | //qDebug("MainWindow::~MainWindow() "); |
365 | //save toolbar location | 365 | //save toolbar location |
366 | delete mCalendar; | 366 | delete mCalendar; |
367 | delete mSyncManager; | 367 | delete mSyncManager; |
368 | #ifndef DESKTOP_VERSION | 368 | #ifndef DESKTOP_VERSION |
369 | if ( infrared ) | 369 | if ( infrared ) |
370 | delete infrared; | 370 | delete infrared; |
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | 373 | ||
374 | } | 374 | } |
375 | 375 | ||
376 | void MainWindow::disableBR(bool b) | 376 | void MainWindow::disableBR(bool b) |
377 | { | 377 | { |
378 | #ifndef DESKTOP_VERSION | 378 | #ifndef DESKTOP_VERSION |
379 | if ( b ) { | 379 | if ( b ) { |
380 | if ( infrared ) { | 380 | if ( infrared ) { |
381 | toggleBeamReceive(); | 381 | toggleBeamReceive(); |
382 | mBRdisabled = true; | 382 | mBRdisabled = true; |
383 | } | 383 | } |
384 | mBRdisabled = true; | 384 | mBRdisabled = true; |
385 | } else { | 385 | } else { |
386 | if ( mBRdisabled ) { | 386 | if ( mBRdisabled ) { |
387 | mBRdisabled = false; | 387 | mBRdisabled = false; |
388 | //makes no sense,because other cal ap is probably running | 388 | //makes no sense,because other cal ap is probably running |
389 | // toggleBeamReceive(); | 389 | // toggleBeamReceive(); |
390 | } | 390 | } |
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | 393 | ||
394 | } | 394 | } |
395 | bool MainWindow::beamReceiveEnabled() | 395 | bool MainWindow::beamReceiveEnabled() |
396 | { | 396 | { |
397 | #ifndef DESKTOP_VERSION | 397 | #ifndef DESKTOP_VERSION |
398 | return ( infrared != 0 ); | 398 | return ( infrared != 0 ); |
399 | #endif | 399 | #endif |
400 | return false; | 400 | return false; |
401 | } | 401 | } |
402 | 402 | ||
403 | void MainWindow::toggleBeamReceive() | 403 | void MainWindow::toggleBeamReceive() |
404 | { | 404 | { |
405 | if ( mBRdisabled ) | 405 | if ( mBRdisabled ) |
406 | return; | 406 | return; |
407 | #ifndef DESKTOP_VERSION | 407 | #ifndef DESKTOP_VERSION |
408 | if ( infrared ) { | 408 | if ( infrared ) { |
409 | qDebug("disable BeamReceive "); | 409 | qDebug("disable BeamReceive "); |
410 | delete infrared; | 410 | delete infrared; |
411 | infrared = 0; | 411 | infrared = 0; |
412 | brAction->setOn(false); | 412 | brAction->setOn(false); |
413 | return; | 413 | return; |
414 | } | 414 | } |
415 | qDebug("enable BeamReceive "); | 415 | qDebug("enable BeamReceive "); |
416 | brAction->setOn(true); | 416 | brAction->setOn(true); |
417 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 417 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
418 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 418 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
419 | #endif | 419 | #endif |
420 | } | 420 | } |
421 | void MainWindow::showMaximized () | 421 | void MainWindow::showMaximized () |
422 | { | 422 | { |
423 | #ifndef DESKTOP_VERSION | 423 | #ifndef DESKTOP_VERSION |
424 | if ( ! globalFlagBlockStartup ) | 424 | if ( ! globalFlagBlockStartup ) |
425 | if ( mClosed ) | 425 | if ( mClosed ) |
426 | mView->goToday(); | 426 | mView->goToday(); |
427 | #endif | 427 | #endif |
428 | QWidget::showMaximized () ; | 428 | QWidget::showMaximized () ; |
429 | mClosed = false; | 429 | mClosed = false; |
430 | } | 430 | } |
431 | void MainWindow::closeEvent( QCloseEvent* ce ) | 431 | void MainWindow::closeEvent( QCloseEvent* ce ) |
432 | { | 432 | { |
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 436 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
437 | saveOnClose(); | 437 | saveOnClose(); |
438 | mClosed = true; | 438 | mClosed = true; |
439 | ce->accept(); | 439 | ce->accept(); |
440 | return; | 440 | return; |
441 | 441 | ||
442 | } | 442 | } |
443 | 443 | ||
444 | switch( QMessageBox::information( this, "KO/Pi", | 444 | switch( QMessageBox::information( this, "KO/Pi", |
445 | i18n("Do you really want\nto close KO/Pi?"), | 445 | i18n("Do you really want\nto close KO/Pi?"), |
446 | i18n("Close"), i18n("No"), | 446 | i18n("Close"), i18n("No"), |
447 | 0, 0 ) ) { | 447 | 0, 0 ) ) { |
448 | case 0: | 448 | case 0: |
449 | saveOnClose(); | 449 | saveOnClose(); |
450 | mClosed = true; | 450 | mClosed = true; |
451 | ce->accept(); | 451 | ce->accept(); |
452 | break; | 452 | break; |
453 | case 1: | 453 | case 1: |
454 | ce->ignore(); | 454 | ce->ignore(); |
455 | break; | 455 | break; |
456 | case 2: | 456 | case 2: |
457 | 457 | ||
458 | default: | 458 | default: |
459 | break; | 459 | break; |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | } | 463 | } |
464 | 464 | ||
465 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 465 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
466 | { | 466 | { |
467 | QDataStream stream( data, IO_ReadOnly ); | 467 | QDataStream stream( data, IO_ReadOnly ); |
468 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 468 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
469 | //QString datamess; | 469 | //QString datamess; |
470 | //qDebug("message "); | 470 | //qDebug("message "); |
471 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 471 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
472 | 472 | ||
473 | if ( cmsg == "setDocument(QString)" ) { | 473 | if ( cmsg == "setDocument(QString)" ) { |
474 | QDataStream stream( data, IO_ReadOnly ); | 474 | QDataStream stream( data, IO_ReadOnly ); |
475 | QString fileName; | 475 | QString fileName; |
476 | stream >> fileName; | 476 | stream >> fileName; |
477 | //qDebug("filename %s ", fileName.latin1()); | 477 | //qDebug("filename %s ", fileName.latin1()); |
478 | showMaximized(); | 478 | showMaximized(); |
479 | raise(); | 479 | raise(); |
480 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 480 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
481 | mSyncManager->slotSyncMenu( 1002 ); | 481 | mSyncManager->slotSyncMenu( 1002 ); |
482 | return; | 482 | return; |
483 | } | 483 | } |
484 | 484 | ||
485 | if ( cmsg == "-writeFile" ) { | 485 | if ( cmsg == "-writeFile" ) { |
486 | // I made from the "-writeFile" an "-writeAlarm" | 486 | // I made from the "-writeFile" an "-writeAlarm" |
487 | mView->viewManager()->showWhatsNextView(); | 487 | mView->viewManager()->showWhatsNextView(); |
488 | mCalendar->checkAlarmForIncidence( 0, true); | 488 | mCalendar->checkAlarmForIncidence( 0, true); |
489 | showMaximized(); | 489 | showMaximized(); |
490 | raise(); | 490 | raise(); |
491 | return; | 491 | return; |
492 | 492 | ||
493 | } | 493 | } |
494 | if ( cmsg == "-writeFileSilent" ) { | 494 | if ( cmsg == "-writeFileSilent" ) { |
495 | // I made from the "-writeFile" an "-writeAlarm" | 495 | // I made from the "-writeFile" an "-writeAlarm" |
496 | // mView->viewManager()->showWhatsNextView(); | 496 | // mView->viewManager()->showWhatsNextView(); |
497 | mCalendar->checkAlarmForIncidence( 0, true); | 497 | mCalendar->checkAlarmForIncidence( 0, true); |
498 | //showMaximized(); | 498 | //showMaximized(); |
499 | //raise(); | 499 | //raise(); |
500 | hide(); | 500 | hide(); |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | if ( cmsg == "-newCountdown" ) { | 503 | if ( cmsg == "-newCountdown" ) { |
504 | qDebug("newCountdown "); | 504 | qDebug("newCountdown "); |
505 | 505 | ||
506 | } | 506 | } |
507 | QString msg ; | 507 | QString msg ; |
508 | QString allmsg = cmsg; | 508 | QString allmsg = cmsg; |
509 | while ( allmsg.length() > 0 ) { | 509 | while ( allmsg.length() > 0 ) { |
510 | int nextC = allmsg.find( "-", 1 ); | 510 | int nextC = allmsg.find( "-", 1 ); |
511 | if ( nextC == -1 ) { | 511 | if ( nextC == -1 ) { |
512 | msg = allmsg; | 512 | msg = allmsg; |
513 | allmsg = ""; | 513 | allmsg = ""; |
514 | } else{ | 514 | } else{ |
515 | msg = allmsg.left( nextC ); | 515 | msg = allmsg.left( nextC ); |
516 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 516 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
517 | } | 517 | } |
518 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 518 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
519 | if ( msg == "-newEvent" ) { | 519 | if ( msg == "-newEvent" ) { |
520 | mView->newEvent(); | 520 | mView->newEvent(); |
521 | } | 521 | } |
522 | if ( msg == "-newTodo" ) { | 522 | if ( msg == "-newTodo" ) { |
523 | mView->newTodo(); | 523 | mView->newTodo(); |
524 | 524 | ||
525 | } | 525 | } |
526 | if ( msg == "-showWN" ) { | 526 | if ( msg == "-showWN" ) { |
527 | mView->viewManager()->showWhatsNextView(); | 527 | mView->viewManager()->showWhatsNextView(); |
528 | } | 528 | } |
529 | if ( msg == "-showTodo" ) { | 529 | if ( msg == "-showTodo" ) { |
530 | mView->viewManager()->showTodoView(); | 530 | mView->viewManager()->showTodoView(); |
531 | } | 531 | } |
532 | if ( msg == "-showList" ) { | 532 | if ( msg == "-showList" ) { |
533 | mView->viewManager()->showListView(); | 533 | mView->viewManager()->showListView(); |
534 | } | 534 | } |
535 | else if ( msg == "-showDay" ) { | 535 | else if ( msg == "-showDay" ) { |
536 | mView->viewManager()->showDayView(); | 536 | mView->viewManager()->showDayView(); |
537 | } | 537 | } |
538 | else if ( msg == "-showWWeek" ) { | 538 | else if ( msg == "-showWWeek" ) { |
539 | mView->viewManager()->showWorkWeekView(); | 539 | mView->viewManager()->showWorkWeekView(); |
540 | } | 540 | } |
541 | else if ( msg == "-ringSync" ) { | 541 | else if ( msg == "-ringSync" ) { |
542 | mSyncManager->multiSync( false ); | 542 | mSyncManager->multiSync( false ); |
543 | } | 543 | } |
544 | else if ( msg == "-showWeek" ) { | 544 | else if ( msg == "-showWeek" ) { |
545 | mView->viewManager()->showWeekView(); | 545 | mView->viewManager()->showWeekView(); |
546 | } | 546 | } |
547 | else if ( msg == "-showTodo" ) { | 547 | else if ( msg == "-showTodo" ) { |
548 | mView->viewManager()->showTodoView(); | 548 | mView->viewManager()->showTodoView(); |
549 | } | 549 | } |
550 | else if ( msg == "-showJournal" ) { | 550 | else if ( msg == "-showJournal" ) { |
551 | mView->dateNavigator()->selectDates( 1 ); | 551 | mView->dateNavigator()->selectDates( 1 ); |
552 | mView->dateNavigator()->selectToday(); | 552 | mView->dateNavigator()->selectToday(); |
553 | mView->viewManager()->showJournalView(); | 553 | mView->viewManager()->showJournalView(); |
554 | } | 554 | } |
555 | else if ( msg == "-showKO" ) { | 555 | else if ( msg == "-showKO" ) { |
556 | mView->viewManager()->showNextXView(); | 556 | mView->viewManager()->showNextXView(); |
557 | } | 557 | } |
558 | else if ( msg == "-showWNext" ) { | 558 | else if ( msg == "-showWNext" ) { |
559 | mView->viewManager()->showWhatsNextView(); | 559 | mView->viewManager()->showWhatsNextView(); |
560 | } | 560 | } |
561 | else if ( msg == "nextView()" ) { | 561 | else if ( msg == "nextView()" ) { |
562 | mView->viewManager()->showNextView(); | 562 | mView->viewManager()->showNextView(); |
563 | } | 563 | } |
564 | else if ( msg == "-showNextXView" ) { | 564 | else if ( msg == "-showNextXView" ) { |
565 | mView->viewManager()->showNextXView(); | 565 | mView->viewManager()->showNextXView(); |
566 | } | 566 | } |
567 | 567 | ||
568 | 568 | ||
569 | } | 569 | } |
570 | 570 | ||
571 | showMaximized(); | 571 | showMaximized(); |
572 | raise(); | 572 | raise(); |
573 | } | 573 | } |
574 | 574 | ||
575 | QPixmap MainWindow::loadPixmap( QString name ) | 575 | QPixmap MainWindow::loadPixmap( QString name ) |
576 | { | 576 | { |
577 | return SmallIcon( name ); | 577 | return SmallIcon( name ); |
578 | 578 | ||
579 | } | 579 | } |
580 | void MainWindow::initActions() | 580 | void MainWindow::initActions() |
581 | { | 581 | { |
582 | //KOPrefs::instance()->mShowFullMenu | 582 | //KOPrefs::instance()->mShowFullMenu |
583 | iconToolBar->clear(); | 583 | iconToolBar->clear(); |
584 | KOPrefs *p = KOPrefs::instance(); | 584 | KOPrefs *p = KOPrefs::instance(); |
585 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 585 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
586 | 586 | ||
587 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 587 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
588 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 588 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
589 | QPopupMenu *importMenu = new QPopupMenu( this ); | 589 | QPopupMenu *importMenu = new QPopupMenu( this ); |
590 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 590 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
591 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 591 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
592 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 592 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
593 | selectFilterMenu = new QPopupMenu( this ); | 593 | selectFilterMenu = new QPopupMenu( this ); |
594 | selectFilterMenu->setCheckable( true ); | 594 | selectFilterMenu->setCheckable( true ); |
595 | syncMenu = new QPopupMenu( this ); | 595 | syncMenu = new QPopupMenu( this ); |
596 | configureAgendaMenu = new QPopupMenu( this ); | 596 | configureAgendaMenu = new QPopupMenu( this ); |
597 | configureToolBarMenu = new QPopupMenu( this ); | 597 | configureToolBarMenu = new QPopupMenu( this ); |
598 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 598 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
599 | QIconSet icon; | 599 | QIconSet icon; |
600 | int pixWid = 22, pixHei = 22; | 600 | int pixWid = 22, pixHei = 22; |
601 | QString pathString = ""; | 601 | QString pathString = ""; |
602 | if ( !p->mToolBarMiniIcons ) { | 602 | if ( !p->mToolBarMiniIcons ) { |
603 | if ( QApplication::desktop()->width() < 480 ) { | 603 | if ( QApplication::desktop()->width() < 480 ) { |
604 | pathString += "icons16/"; | 604 | pathString += "icons16/"; |
605 | pixWid = 18; pixHei = 16; | 605 | pixWid = 18; pixHei = 16; |
606 | } | 606 | } |
607 | } else { | 607 | } else { |
608 | pathString += "iconsmini/"; | 608 | pathString += "iconsmini/"; |
609 | pixWid = 18; pixHei = 16; | 609 | pixWid = 18; pixHei = 16; |
610 | } | 610 | } |
611 | if ( KOPrefs::instance()->mShowFullMenu ) { | 611 | if ( KOPrefs::instance()->mShowFullMenu ) { |
612 | QMenuBar *menuBar1; | 612 | QMenuBar *menuBar1; |
613 | menuBar1 = menuBar(); | 613 | menuBar1 = menuBar(); |
614 | menuBar1->insertItem( i18n("File"), importMenu ); | 614 | menuBar1->insertItem( i18n("File"), importMenu ); |
615 | menuBar1->insertItem( i18n("View"), viewMenu ); | 615 | menuBar1->insertItem( i18n("View"), viewMenu ); |
616 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 616 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
617 | #ifdef DESKTOP_VERSION | 617 | #ifdef DESKTOP_VERSION |
618 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 618 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
619 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 619 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
620 | #else | 620 | #else |
621 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 621 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
622 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 622 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
623 | #endif | 623 | #endif |
624 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 624 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
625 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 625 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
626 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 626 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
627 | } else { | 627 | } else { |
628 | QPEMenuBar *menuBar1; | 628 | QPEMenuBar *menuBar1; |
629 | menuBar1 = new QPEMenuBar( iconToolBar ); | 629 | menuBar1 = new QPEMenuBar( iconToolBar ); |
630 | QPopupMenu *menuBar = new QPopupMenu( this ); | 630 | QPopupMenu *menuBar = new QPopupMenu( this ); |
631 | icon = loadPixmap( pathString + "z_menu" ); | 631 | icon = loadPixmap( pathString + "z_menu" ); |
632 | menuBar1->insertItem( icon.pixmap(), menuBar); | 632 | menuBar1->insertItem( icon.pixmap(), menuBar); |
633 | //menuBar1->insertItem( i18n("ME"), menuBar); | 633 | //menuBar1->insertItem( i18n("ME"), menuBar); |
634 | menuBar->insertItem( i18n("File"), importMenu ); | 634 | menuBar->insertItem( i18n("File"), importMenu ); |
635 | menuBar->insertItem( i18n("View"), viewMenu ); | 635 | menuBar->insertItem( i18n("View"), viewMenu ); |
636 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 636 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
637 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 637 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
638 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 638 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
639 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 639 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
640 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 640 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
641 | menuBar->insertItem( i18n("Help"), helpMenu ); | 641 | menuBar->insertItem( i18n("Help"), helpMenu ); |
642 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 642 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
643 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 643 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
644 | } | 644 | } |
645 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 645 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
646 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 646 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
647 | |||
648 | |||
647 | mWeekBgColor = iconToolBar->backgroundColor(); | 649 | mWeekBgColor = iconToolBar->backgroundColor(); |
648 | mWeekPixmap.resize( pixWid , pixHei ); | 650 | mWeekPixmap.resize( pixWid , pixHei ); |
649 | mWeekPixmap.fill( mWeekBgColor ); | 651 | mWeekPixmap.fill( mWeekBgColor ); |
650 | icon = mWeekPixmap; | 652 | icon = mWeekPixmap; |
651 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 653 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
652 | if ( p-> mShowIconWeekNum ) | 654 | if ( p-> mShowIconWeekNum ) |
653 | mWeekAction->addTo( iconToolBar ); | 655 | mWeekAction->addTo( iconToolBar ); |
654 | mWeekFont = font(); | 656 | mWeekFont = font(); |
655 | 657 | ||
656 | int fontPoint = mWeekFont.pointSize(); | 658 | int fontPoint = mWeekFont.pointSize(); |
657 | QFontMetrics f( mWeekFont ); | 659 | QFontMetrics f( mWeekFont ); |
658 | int fontWid = f.width( "30" ); | 660 | int fontWid = f.width( "30" ); |
659 | while ( fontWid > pixWid ) { | 661 | while ( fontWid > pixWid ) { |
660 | --fontPoint; | 662 | --fontPoint; |
661 | mWeekFont.setPointSize( fontPoint ); | 663 | mWeekFont.setPointSize( fontPoint ); |
662 | QFontMetrics f( mWeekFont ); | 664 | QFontMetrics f( mWeekFont ); |
663 | fontWid = f.width( "30" ); | 665 | fontWid = f.width( "30" ); |
664 | //qDebug("dec-- "); | 666 | //qDebug("dec-- "); |
665 | } | 667 | } |
666 | 668 | ||
667 | connect( mWeekAction, SIGNAL( activated() ), | 669 | connect( mWeekAction, SIGNAL( activated() ), |
668 | this, SLOT( weekAction() ) ); | 670 | this, SLOT( weekAction() ) ); |
669 | 671 | ||
670 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 672 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
673 | if ( p->mShowIconFilterview ) { | ||
674 | icon = loadPixmap( pathString + "filter" ); | ||
675 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | ||
676 | connect( actionFilterMenuTB, SIGNAL( activated() ), | ||
677 | this, SLOT( fillFilterMenuTB() ) ); | ||
678 | actionFilterMenuTB->addTo( iconToolBar ); | ||
679 | selectFilterMenuTB = new QPopupMenu( this ); | ||
680 | selectFilterMenuTB->setCheckable( true ); | ||
681 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | ||
682 | } | ||
671 | 683 | ||
672 | //#endif | 684 | //#endif |
673 | // ****************** | 685 | // ****************** |
674 | QAction *action; | 686 | QAction *action; |
675 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 687 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
676 | configureToolBarMenu->setCheckable( true ); | 688 | configureToolBarMenu->setCheckable( true ); |
677 | 689 | ||
678 | 690 | ||
679 | configureAgendaMenu->setCheckable( true ); | 691 | configureAgendaMenu->setCheckable( true ); |
680 | int iii ; | 692 | int iii ; |
681 | for ( iii = 1;iii<= 10 ;++iii ){ | 693 | for ( iii = 1;iii<= 10 ;++iii ){ |
682 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 694 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
683 | } | 695 | } |
684 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 696 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
685 | 697 | ||
686 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 698 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
687 | this, SLOT( showConfigureAgenda( ) ) ); | 699 | this, SLOT( showConfigureAgenda( ) ) ); |
688 | 700 | ||
689 | icon = loadPixmap( pathString + "configure" ); | 701 | icon = loadPixmap( pathString + "configure" ); |
690 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 702 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
691 | action->addTo( actionMenu ); | 703 | action->addTo( actionMenu ); |
692 | connect( action, SIGNAL( activated() ), | 704 | connect( action, SIGNAL( activated() ), |
693 | mView, SLOT( edit_options() ) ); | 705 | mView, SLOT( edit_options() ) ); |
694 | actionMenu->insertSeparator(); | 706 | actionMenu->insertSeparator(); |
695 | 707 | ||
696 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 708 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
697 | action->addTo( actionMenu ); | 709 | action->addTo( actionMenu ); |
698 | connect( action, SIGNAL( activated() ), | 710 | connect( action, SIGNAL( activated() ), |
699 | mView, SLOT( undo_delete() ) ); | 711 | mView, SLOT( undo_delete() ) ); |
700 | actionMenu->insertSeparator(); | 712 | actionMenu->insertSeparator(); |
701 | 713 | ||
702 | icon = loadPixmap( pathString + "newevent" ); | 714 | icon = loadPixmap( pathString + "newevent" ); |
703 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 715 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
704 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 716 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
705 | configureToolBarMenu->insertSeparator(); | 717 | configureToolBarMenu->insertSeparator(); |
706 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 718 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
707 | configureToolBarMenu->insertSeparator(); | 719 | configureToolBarMenu->insertSeparator(); |
708 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 720 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
709 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 721 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
710 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 722 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
711 | ne_action->addTo( actionMenu ); | 723 | ne_action->addTo( actionMenu ); |
712 | connect( ne_action, SIGNAL( activated() ), | 724 | connect( ne_action, SIGNAL( activated() ), |
713 | mView, SLOT( newEvent() ) ); | 725 | mView, SLOT( newEvent() ) ); |
714 | icon = loadPixmap( pathString + "newtodo" ); | 726 | icon = loadPixmap( pathString + "newtodo" ); |
715 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 727 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
716 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 728 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
717 | nt_action->addTo( actionMenu ); | 729 | nt_action->addTo( actionMenu ); |
718 | connect( nt_action, SIGNAL( activated() ), | 730 | connect( nt_action, SIGNAL( activated() ), |
719 | mView, SLOT( newTodo() ) ); | 731 | mView, SLOT( newTodo() ) ); |
720 | 732 | ||
721 | icon = loadPixmap( pathString + "today" ); | 733 | icon = loadPixmap( pathString + "today" ); |
722 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 734 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
723 | today_action->addTo( viewMenu ); | 735 | today_action->addTo( viewMenu ); |
724 | connect( today_action, SIGNAL( activated() ), | 736 | connect( today_action, SIGNAL( activated() ), |
725 | mView, SLOT( goToday() ) ); | 737 | mView, SLOT( goToday() ) ); |
726 | viewMenu->insertSeparator(); | 738 | viewMenu->insertSeparator(); |
727 | 739 | ||
728 | // *********************** | 740 | // *********************** |
729 | if ( KOPrefs::instance()->mVerticalScreen ) { | 741 | if ( KOPrefs::instance()->mVerticalScreen ) { |
730 | icon = SmallIcon( "1updownarrow" ); | 742 | icon = SmallIcon( "1updownarrow" ); |
731 | } else { | 743 | } else { |
732 | icon = SmallIcon("1leftrightarrow" ); | 744 | icon = SmallIcon("1leftrightarrow" ); |
733 | } | 745 | } |
734 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 746 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
735 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 747 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
736 | FSaction->addTo( viewMenu ); | 748 | FSaction->addTo( viewMenu ); |
737 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 749 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
738 | 750 | ||
739 | icon = loadPixmap( pathString + "navi" ); | 751 | icon = loadPixmap( pathString + "navi" ); |
740 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 752 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
741 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 753 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
742 | action->addTo( viewMenu ); | 754 | action->addTo( viewMenu ); |
743 | connect( action, SIGNAL( activated() ), | 755 | connect( action, SIGNAL( activated() ), |
744 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 756 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
745 | mToggleNav = action ; | 757 | mToggleNav = action ; |
746 | icon = loadPixmap( pathString + "filter" ); | 758 | icon = loadPixmap( pathString + "filter" ); |
747 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 759 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
748 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 760 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
749 | action->addTo( viewMenu ); | 761 | action->addTo( viewMenu ); |
750 | connect( action, SIGNAL( activated() ), | 762 | connect( action, SIGNAL( activated() ), |
751 | mView, SLOT( toggleFilter() ) ); | 763 | mView, SLOT( toggleFilter() ) ); |
752 | mToggleFilter = action; | 764 | mToggleFilter = action; |
753 | icon = loadPixmap( pathString + "allday" ); | 765 | icon = loadPixmap( pathString + "allday" ); |
754 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 766 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
755 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 767 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
756 | action->addTo( viewMenu ); | 768 | action->addTo( viewMenu ); |
757 | connect( action, SIGNAL( activated() ), | 769 | connect( action, SIGNAL( activated() ), |
758 | mView, SLOT( toggleAllDaySize() ) ); | 770 | mView, SLOT( toggleAllDaySize() ) ); |
759 | mToggleAllday = action; | 771 | mToggleAllday = action; |
760 | 772 | ||
761 | 773 | ||
762 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 774 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
763 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 775 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
764 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 776 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
765 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 777 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
766 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 778 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
767 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 779 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
768 | 780 | ||
769 | viewMenu->insertSeparator(); | 781 | viewMenu->insertSeparator(); |
770 | icon = loadPixmap( pathString + "picker" ); | 782 | icon = loadPixmap( pathString + "picker" ); |
771 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 783 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
772 | action->addTo( viewMenu ); | 784 | action->addTo( viewMenu ); |
773 | connect( action, SIGNAL( activated() ), | 785 | connect( action, SIGNAL( activated() ), |
774 | mView, SLOT( showDatePicker() ) ); | 786 | mView, SLOT( showDatePicker() ) ); |
775 | action->addTo( iconToolBar ); | 787 | action->addTo( iconToolBar ); |
776 | viewMenu->insertSeparator(); | 788 | viewMenu->insertSeparator(); |
777 | 789 | ||
778 | if ( p-> mShowIconToggleFull ) | 790 | if ( p-> mShowIconToggleFull ) |
779 | FSaction->addTo( iconToolBar ); | 791 | FSaction->addTo( iconToolBar ); |
780 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 792 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
781 | if ( p->mShowIconFilterview ) { | 793 | |
782 | icon = loadPixmap( pathString + "filter" ); | ||
783 | QPEMenuBar *menuBar111 = new QPEMenuBar( iconToolBar ); | ||
784 | menuBar111->insertItem( icon.pixmap(), selectFilterMenu); | ||
785 | int isi = 24; | ||
786 | if ( QApplication::desktop()->width() < 480 ) | ||
787 | isi = 18; | ||
788 | menuBar111->setFixedSize( QSize( isi, isi )) ; | ||
789 | } | ||
790 | //******************** | 794 | //******************** |
791 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 795 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
792 | 796 | ||
793 | 797 | ||
794 | icon = loadPixmap( pathString + "whatsnext" ); | 798 | icon = loadPixmap( pathString + "whatsnext" ); |
795 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 799 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
796 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 800 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
797 | whatsnext_action->addTo( viewMenu ); | 801 | whatsnext_action->addTo( viewMenu ); |
798 | connect( whatsnext_action, SIGNAL( activated() ), | 802 | connect( whatsnext_action, SIGNAL( activated() ), |
799 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 803 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
800 | 804 | ||
801 | icon = loadPixmap( pathString + "xdays" ); | 805 | icon = loadPixmap( pathString + "xdays" ); |
802 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 806 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
803 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 807 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
804 | xdays_action->addTo( viewMenu ); | 808 | xdays_action->addTo( viewMenu ); |
805 | connect( xdays_action, SIGNAL( activated() ), | 809 | connect( xdays_action, SIGNAL( activated() ), |
806 | mView->viewManager(), SLOT( showNextXView() ) ); | 810 | mView->viewManager(), SLOT( showNextXView() ) ); |
807 | 811 | ||
808 | 812 | ||
809 | icon = loadPixmap( pathString + "journal" ); | 813 | icon = loadPixmap( pathString + "journal" ); |
810 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 814 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
811 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 815 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
812 | viewjournal_action->addTo( viewMenu ); | 816 | viewjournal_action->addTo( viewMenu ); |
813 | connect( viewjournal_action, SIGNAL( activated() ), | 817 | connect( viewjournal_action, SIGNAL( activated() ), |
814 | mView->viewManager(), SLOT( showJournalView() ) ); | 818 | mView->viewManager(), SLOT( showJournalView() ) ); |
815 | 819 | ||
816 | 820 | ||
817 | icon = loadPixmap( pathString + "day" ); | 821 | icon = loadPixmap( pathString + "day" ); |
818 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 822 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
819 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 823 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
820 | day1_action->addTo( viewMenu ); | 824 | day1_action->addTo( viewMenu ); |
821 | // action->addTo( toolBar ); | 825 | // action->addTo( toolBar ); |
822 | connect( day1_action, SIGNAL( activated() ), | 826 | connect( day1_action, SIGNAL( activated() ), |
823 | mView->viewManager(), SLOT( showDayView() ) ); | 827 | mView->viewManager(), SLOT( showDayView() ) ); |
824 | 828 | ||
825 | icon = loadPixmap( pathString + "workweek" ); | 829 | icon = loadPixmap( pathString + "workweek" ); |
826 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 830 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
827 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 831 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
828 | day5_action->addTo( viewMenu ); | 832 | day5_action->addTo( viewMenu ); |
829 | connect( day5_action, SIGNAL( activated() ), | 833 | connect( day5_action, SIGNAL( activated() ), |
830 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 834 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
831 | 835 | ||
832 | icon = loadPixmap( pathString + "week" ); | 836 | icon = loadPixmap( pathString + "week" ); |
833 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 837 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
834 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 838 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
835 | day7_action->addTo( viewMenu ); | 839 | day7_action->addTo( viewMenu ); |
836 | connect( day7_action, SIGNAL( activated() ), | 840 | connect( day7_action, SIGNAL( activated() ), |
837 | mView->viewManager(), SLOT( showWeekView() ) ); | 841 | mView->viewManager(), SLOT( showWeekView() ) ); |
838 | 842 | ||
839 | icon = loadPixmap( pathString + "workweek2" ); | 843 | icon = loadPixmap( pathString + "workweek2" ); |
840 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 844 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
841 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 845 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
842 | day6_action->addTo( viewMenu ); | 846 | day6_action->addTo( viewMenu ); |
843 | connect( day6_action, SIGNAL( activated() ), | 847 | connect( day6_action, SIGNAL( activated() ), |
844 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 848 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
845 | 849 | ||
846 | icon = loadPixmap( pathString + "month" ); | 850 | icon = loadPixmap( pathString + "month" ); |
847 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 851 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
848 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 852 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
849 | month_action->addTo( viewMenu ); | 853 | month_action->addTo( viewMenu ); |
850 | connect( month_action, SIGNAL( activated() ), | 854 | connect( month_action, SIGNAL( activated() ), |
851 | mView->viewManager(), SLOT( showMonthView() ) ); | 855 | mView->viewManager(), SLOT( showMonthView() ) ); |
852 | 856 | ||
853 | icon = loadPixmap( pathString + "list" ); | 857 | icon = loadPixmap( pathString + "list" ); |
854 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 858 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
855 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 859 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
856 | showlist_action->addTo( viewMenu ); | 860 | showlist_action->addTo( viewMenu ); |
857 | connect( showlist_action, SIGNAL( activated() ), | 861 | connect( showlist_action, SIGNAL( activated() ), |
858 | mView->viewManager(), SLOT( showListView() ) ); | 862 | mView->viewManager(), SLOT( showListView() ) ); |
859 | 863 | ||
860 | icon = loadPixmap( pathString + "todo" ); | 864 | icon = loadPixmap( pathString + "todo" ); |
861 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 865 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
862 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 866 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
863 | todoview_action->addTo( viewMenu ); | 867 | todoview_action->addTo( viewMenu ); |
864 | connect( todoview_action, SIGNAL( activated() ), | 868 | connect( todoview_action, SIGNAL( activated() ), |
865 | mView->viewManager(), SLOT( showTodoView() ) ); | 869 | mView->viewManager(), SLOT( showTodoView() ) ); |
866 | 870 | ||
867 | 871 | ||
868 | 872 | ||
869 | #if 0 | 873 | #if 0 |
870 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 874 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
871 | action->addTo( viewMenu ); | 875 | action->addTo( viewMenu ); |
872 | connect( action, SIGNAL( activated() ), | 876 | connect( action, SIGNAL( activated() ), |
873 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 877 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
874 | #endif | 878 | #endif |
875 | 879 | ||
876 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 880 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
877 | this ); | 881 | this ); |
878 | mNewSubTodoAction->addTo( actionMenu ); | 882 | mNewSubTodoAction->addTo( actionMenu ); |
879 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 883 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
880 | mView, SLOT( newSubTodo() ) ); | 884 | mView, SLOT( newSubTodo() ) ); |
881 | 885 | ||
882 | actionMenu->insertSeparator(); | 886 | actionMenu->insertSeparator(); |
883 | 887 | ||
884 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 888 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
885 | mShowAction->addTo( actionMenu ); | 889 | mShowAction->addTo( actionMenu ); |
886 | connect( mShowAction, SIGNAL( activated() ), | 890 | connect( mShowAction, SIGNAL( activated() ), |
887 | mView, SLOT( showIncidence() ) ); | 891 | mView, SLOT( showIncidence() ) ); |
888 | 892 | ||
889 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 893 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
890 | mEditAction->addTo( actionMenu ); | 894 | mEditAction->addTo( actionMenu ); |
891 | connect( mEditAction, SIGNAL( activated() ), | 895 | connect( mEditAction, SIGNAL( activated() ), |
892 | mView, SLOT( editIncidence() ) ); | 896 | mView, SLOT( editIncidence() ) ); |
893 | 897 | ||
894 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 898 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
895 | mDeleteAction->addTo( actionMenu ); | 899 | mDeleteAction->addTo( actionMenu ); |
896 | connect( mDeleteAction, SIGNAL( activated() ), | 900 | connect( mDeleteAction, SIGNAL( activated() ), |
897 | mView, SLOT( deleteIncidence() ) ); | 901 | mView, SLOT( deleteIncidence() ) ); |
898 | 902 | ||
899 | 903 | ||
900 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 904 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
901 | mCloneAction->addTo( actionMenu ); | 905 | mCloneAction->addTo( actionMenu ); |
902 | connect( mCloneAction, SIGNAL( activated() ), | 906 | connect( mCloneAction, SIGNAL( activated() ), |
903 | mView, SLOT( cloneIncidence() ) ); | 907 | mView, SLOT( cloneIncidence() ) ); |
904 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 908 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
905 | mMoveAction->addTo( actionMenu ); | 909 | mMoveAction->addTo( actionMenu ); |
906 | connect( mMoveAction, SIGNAL( activated() ), | 910 | connect( mMoveAction, SIGNAL( activated() ), |
907 | mView, SLOT( moveIncidence() ) ); | 911 | mView, SLOT( moveIncidence() ) ); |
908 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 912 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
909 | mBeamAction->addTo( actionMenu ); | 913 | mBeamAction->addTo( actionMenu ); |
910 | connect( mBeamAction, SIGNAL( activated() ), | 914 | connect( mBeamAction, SIGNAL( activated() ), |
911 | mView, SLOT( beamIncidence() ) ); | 915 | mView, SLOT( beamIncidence() ) ); |
912 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 916 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
913 | mCancelAction->addTo( actionMenu ); | 917 | mCancelAction->addTo( actionMenu ); |
914 | connect( mCancelAction, SIGNAL( activated() ), | 918 | connect( mCancelAction, SIGNAL( activated() ), |
915 | mView, SLOT( toggleCancelIncidence() ) ); | 919 | mView, SLOT( toggleCancelIncidence() ) ); |
916 | 920 | ||
917 | actionMenu->insertSeparator(); | 921 | actionMenu->insertSeparator(); |
918 | 922 | ||
919 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 923 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
920 | this ); | 924 | this ); |
921 | action->addTo( actionMenu ); | 925 | action->addTo( actionMenu ); |
922 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 926 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
923 | 927 | ||
924 | icon = loadPixmap( pathString + "search" ); | 928 | icon = loadPixmap( pathString + "search" ); |
925 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 929 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
926 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 930 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
927 | search_action->addTo( actionMenu ); | 931 | search_action->addTo( actionMenu ); |
928 | connect( search_action, SIGNAL( activated() ), | 932 | connect( search_action, SIGNAL( activated() ), |
929 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 933 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
930 | 934 | ||
931 | 935 | ||
932 | 936 | ||
933 | if ( KOPrefs::instance()->mShowFullMenu ) { | 937 | if ( KOPrefs::instance()->mShowFullMenu ) { |
934 | actionMenu->insertSeparator(); | 938 | actionMenu->insertSeparator(); |
935 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 939 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
936 | 940 | ||
937 | } | 941 | } |
938 | // actionMenu->insertSeparator(); | 942 | // actionMenu->insertSeparator(); |
939 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 943 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
940 | this ); | 944 | this ); |
941 | action->addTo( importMenu_X ); | 945 | action->addTo( importMenu_X ); |
942 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 946 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
943 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 947 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
944 | this ); | 948 | this ); |
945 | action->addTo( importMenu_X ); | 949 | action->addTo( importMenu_X ); |
946 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 950 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
947 | importMenu_X->insertSeparator(); | 951 | importMenu_X->insertSeparator(); |
948 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 952 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
949 | this ); | 953 | this ); |
950 | action->addTo( importMenu_X ); | 954 | action->addTo( importMenu_X ); |
951 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 955 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
952 | //#ifndef DESKTOP_VERSION | 956 | //#ifndef DESKTOP_VERSION |
953 | importMenu_X->insertSeparator(); | 957 | importMenu_X->insertSeparator(); |
954 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 958 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
955 | this ); | 959 | this ); |
956 | action->addTo( importMenu_X ); | 960 | action->addTo( importMenu_X ); |
957 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 961 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
958 | //#else | 962 | //#else |
959 | #ifdef _OL_IMPORT_ | 963 | #ifdef _OL_IMPORT_ |
960 | importMenu_X->insertSeparator(); | 964 | importMenu_X->insertSeparator(); |
961 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 965 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
962 | this ); | 966 | this ); |
963 | action->addTo( importMenu_X ); | 967 | action->addTo( importMenu_X ); |
964 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 968 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
965 | #endif | 969 | #endif |
966 | //#endif | 970 | //#endif |
967 | 971 | ||
968 | //importMenu->insertSeparator(); | 972 | //importMenu->insertSeparator(); |
969 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 973 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
970 | this ); | 974 | this ); |
971 | action->addTo( importMenu ); | 975 | action->addTo( importMenu ); |
972 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 976 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
973 | 977 | ||
974 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 978 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
975 | this ); | 979 | this ); |
976 | action->addTo( importMenu ); | 980 | action->addTo( importMenu ); |
977 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 981 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
978 | importMenu->insertSeparator(); | 982 | importMenu->insertSeparator(); |
979 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 983 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
980 | //importMenu->insertSeparator(); | 984 | //importMenu->insertSeparator(); |
981 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 985 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
982 | this ); | 986 | this ); |
983 | action->addTo( exportMenu_X ); | 987 | action->addTo( exportMenu_X ); |
984 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 988 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
985 | 989 | ||
986 | 990 | ||
987 | //LR | 991 | //LR |
988 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 992 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
989 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 993 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
990 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 994 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
991 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 995 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
992 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 996 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
993 | 997 | ||
994 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 998 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
995 | #ifndef DESKTOP_VERSION | 999 | #ifndef DESKTOP_VERSION |
996 | //importMenu->insertSeparator(); | 1000 | //importMenu->insertSeparator(); |
997 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1001 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
998 | this ); | 1002 | this ); |
999 | brAction->addTo( beamMenu_X ); | 1003 | brAction->addTo( beamMenu_X ); |
1000 | brAction->setToggleAction (true ) ; | 1004 | brAction->setToggleAction (true ) ; |
1001 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1005 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1002 | 1006 | ||
1003 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1007 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1004 | this ); | 1008 | this ); |
1005 | action->addTo( beamMenu_X ); | 1009 | action->addTo( beamMenu_X ); |
1006 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1010 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1007 | 1011 | ||
1008 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1012 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1009 | this ); | 1013 | this ); |
1010 | action->addTo( beamMenu_X ); | 1014 | action->addTo( beamMenu_X ); |
1011 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1015 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1012 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1016 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1013 | #else | 1017 | #else |
1014 | //importMenu->insertSeparator(); | 1018 | //importMenu->insertSeparator(); |
1015 | icon = loadPixmap( pathString + "print" ); | 1019 | icon = loadPixmap( pathString + "print" ); |
1016 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1020 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1017 | action->addTo( beamMenu_X ); | 1021 | action->addTo( beamMenu_X ); |
1018 | connect( action, SIGNAL( activated() ), | 1022 | connect( action, SIGNAL( activated() ), |
1019 | this, SLOT( printCal() ) ); | 1023 | this, SLOT( printCal() ) ); |
1020 | 1024 | ||
1021 | icon = loadPixmap( pathString + "print" ); | 1025 | icon = loadPixmap( pathString + "print" ); |
1022 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1026 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1023 | action->addTo( beamMenu_X ); | 1027 | action->addTo( beamMenu_X ); |
1024 | connect( action, SIGNAL( activated() ), | 1028 | connect( action, SIGNAL( activated() ), |
1025 | this, SLOT( printSel() ) ); | 1029 | this, SLOT( printSel() ) ); |
1026 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1030 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1027 | action->addTo( beamMenu_X ); | 1031 | action->addTo( beamMenu_X ); |
1028 | connect( action, SIGNAL( activated() ), | 1032 | connect( action, SIGNAL( activated() ), |
1029 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1033 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1030 | 1034 | ||
1031 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1035 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1032 | action->addTo( beamMenu_X ); | 1036 | action->addTo( beamMenu_X ); |
1033 | connect( action, SIGNAL( activated() ), | 1037 | connect( action, SIGNAL( activated() ), |
1034 | mView, SLOT( slotprintSelInc() ) ); | 1038 | mView, SLOT( slotprintSelInc() ) ); |
1035 | 1039 | ||
1036 | 1040 | ||
1037 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1041 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1038 | #endif | 1042 | #endif |
1039 | importMenu->insertSeparator(); | 1043 | importMenu->insertSeparator(); |
1040 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1044 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1041 | this ); | 1045 | this ); |
1042 | action->addTo( importMenu ); | 1046 | action->addTo( importMenu ); |
1043 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1047 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1044 | importMenu->insertSeparator(); | 1048 | importMenu->insertSeparator(); |
1045 | action = new QAction( "beam all", i18n("Save"), 0, | 1049 | action = new QAction( "beam all", i18n("Save"), 0, |
1046 | this ); | 1050 | this ); |
1047 | action->addTo( importMenu ); | 1051 | action->addTo( importMenu ); |
1048 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1052 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1049 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1053 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1050 | this ); | 1054 | this ); |
1051 | action->addTo( importMenu ); | 1055 | action->addTo( importMenu ); |
1052 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1056 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1053 | 1057 | ||
1054 | //menuBar->insertItem( "Configure",configureMenu ); | 1058 | //menuBar->insertItem( "Configure",configureMenu ); |
1055 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1059 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1056 | icon = loadPixmap( "korganizer/korganizer" ); | 1060 | icon = loadPixmap( "korganizer/korganizer" ); |
1057 | 1061 | ||
1058 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1062 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1059 | action->addTo( helpMenu ); | 1063 | action->addTo( helpMenu ); |
1060 | connect( action, SIGNAL( activated() ), | 1064 | connect( action, SIGNAL( activated() ), |
1061 | SLOT( whatsNew() ) ); | 1065 | SLOT( whatsNew() ) ); |
1062 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1066 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1063 | action->addTo( helpMenu ); | 1067 | action->addTo( helpMenu ); |
1064 | connect( action, SIGNAL( activated() ), | 1068 | connect( action, SIGNAL( activated() ), |
1065 | SLOT( features() ) ); | 1069 | SLOT( features() ) ); |
1066 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1070 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1067 | action->addTo( helpMenu ); | 1071 | action->addTo( helpMenu ); |
1068 | connect( action, SIGNAL( activated() ), | 1072 | connect( action, SIGNAL( activated() ), |
1069 | SLOT( keyBindings() ) ); | 1073 | SLOT( keyBindings() ) ); |
1070 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1074 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1071 | action->addTo( helpMenu ); | 1075 | action->addTo( helpMenu ); |
1072 | connect( action, SIGNAL( activated() ), | 1076 | connect( action, SIGNAL( activated() ), |
1073 | SLOT( synchowto() ) ); | 1077 | SLOT( synchowto() ) ); |
1074 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1078 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1075 | action->addTo( helpMenu ); | 1079 | action->addTo( helpMenu ); |
1076 | connect( action, SIGNAL( activated() ), | 1080 | connect( action, SIGNAL( activated() ), |
1077 | SLOT( kdesynchowto() ) ); | 1081 | SLOT( kdesynchowto() ) ); |
1078 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1082 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1079 | action->addTo( helpMenu ); | 1083 | action->addTo( helpMenu ); |
1080 | connect( action, SIGNAL( activated() ), | 1084 | connect( action, SIGNAL( activated() ), |
1081 | SLOT( multisynchowto() ) ); | 1085 | SLOT( multisynchowto() ) ); |
1082 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1086 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1083 | action->addTo( helpMenu ); | 1087 | action->addTo( helpMenu ); |
1084 | connect( action, SIGNAL( activated() ), | 1088 | connect( action, SIGNAL( activated() ), |
1085 | SLOT( aboutAutoSaving() ) ); | 1089 | SLOT( aboutAutoSaving() ) ); |
1086 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1090 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1087 | action->addTo( helpMenu ); | 1091 | action->addTo( helpMenu ); |
1088 | connect( action, SIGNAL( activated() ), | 1092 | connect( action, SIGNAL( activated() ), |
1089 | SLOT( aboutKnownBugs() ) ); | 1093 | SLOT( aboutKnownBugs() ) ); |
1090 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1094 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1091 | action->addTo( helpMenu ); | 1095 | action->addTo( helpMenu ); |
1092 | connect( action, SIGNAL( activated() ), | 1096 | connect( action, SIGNAL( activated() ), |
1093 | SLOT( usertrans() ) ); | 1097 | SLOT( usertrans() ) ); |
1094 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1098 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1095 | action->addTo( helpMenu ); | 1099 | action->addTo( helpMenu ); |
1096 | connect( action, SIGNAL( activated() ), | 1100 | connect( action, SIGNAL( activated() ), |
1097 | SLOT( faq() ) ); | 1101 | SLOT( faq() ) ); |
1098 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1102 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1099 | action->addTo( helpMenu ); | 1103 | action->addTo( helpMenu ); |
1100 | connect( action, SIGNAL( activated() ), | 1104 | connect( action, SIGNAL( activated() ), |
1101 | SLOT( licence() ) ); | 1105 | SLOT( licence() ) ); |
1102 | action = new QAction( "about", i18n("About..."), 0, this ); | 1106 | action = new QAction( "about", i18n("About..."), 0, this ); |
1103 | action->addTo( helpMenu ); | 1107 | action->addTo( helpMenu ); |
1104 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1105 | SLOT( about() ) ); | 1109 | SLOT( about() ) ); |
1106 | //menuBar->insertSeparator(); | 1110 | //menuBar->insertSeparator(); |
1107 | 1111 | ||
1108 | // ****************************************************** | 1112 | // ****************************************************** |
1109 | // menubar icons | 1113 | // menubar icons |
1110 | 1114 | ||
1111 | 1115 | ||
1112 | 1116 | ||
1113 | //menuBar->insertItem( iconToolBar ); | 1117 | //menuBar->insertItem( iconToolBar ); |
1114 | //xdays_action | 1118 | //xdays_action |
1115 | if (p-> mShowIconNewEvent) | 1119 | if (p-> mShowIconNewEvent) |
1116 | ne_action->addTo( iconToolBar ); | 1120 | ne_action->addTo( iconToolBar ); |
1117 | if (p->mShowIconNewTodo ) | 1121 | if (p->mShowIconNewTodo ) |
1118 | nt_action->addTo( iconToolBar ); | 1122 | nt_action->addTo( iconToolBar ); |
1119 | if (p-> mShowIconSearch) | 1123 | if (p-> mShowIconSearch) |
1120 | search_action->addTo( iconToolBar ); | 1124 | search_action->addTo( iconToolBar ); |
1121 | if (p-> mShowIconWhatsThis) | 1125 | if (p-> mShowIconWhatsThis) |
1122 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1126 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1123 | if (p-> mShowIconNext) | 1127 | if (p-> mShowIconNext) |
1124 | whatsnext_action->addTo( viewToolBar ); | 1128 | whatsnext_action->addTo( viewToolBar ); |
1125 | if (p-> mShowIconNextDays) | 1129 | if (p-> mShowIconNextDays) |
1126 | xdays_action->addTo( viewToolBar ); | 1130 | xdays_action->addTo( viewToolBar ); |
1127 | if (p-> mShowIconJournal) | 1131 | if (p-> mShowIconJournal) |
1128 | viewjournal_action->addTo( viewToolBar ); | 1132 | viewjournal_action->addTo( viewToolBar ); |
1129 | if (p-> mShowIconDay1) | 1133 | if (p-> mShowIconDay1) |
1130 | day1_action->addTo( viewToolBar ); | 1134 | day1_action->addTo( viewToolBar ); |
1131 | if (p-> mShowIconDay5) | 1135 | if (p-> mShowIconDay5) |
1132 | day5_action->addTo( viewToolBar ); | 1136 | day5_action->addTo( viewToolBar ); |
1133 | if (p-> mShowIconDay7) | 1137 | if (p-> mShowIconDay7) |
1134 | day7_action->addTo( viewToolBar ); | 1138 | day7_action->addTo( viewToolBar ); |
1135 | if (p-> mShowIconDay6) | 1139 | if (p-> mShowIconDay6) |
1136 | day6_action->addTo( viewToolBar ); | 1140 | day6_action->addTo( viewToolBar ); |
1137 | if (p-> mShowIconMonth) | 1141 | if (p-> mShowIconMonth) |
1138 | month_action->addTo( viewToolBar ); | 1142 | month_action->addTo( viewToolBar ); |
1139 | if (p-> mShowIconList) | 1143 | if (p-> mShowIconList) |
1140 | showlist_action->addTo( viewToolBar ); | 1144 | showlist_action->addTo( viewToolBar ); |
1141 | if (p-> mShowIconTodoview) | 1145 | if (p-> mShowIconTodoview) |
1142 | todoview_action->addTo( viewToolBar ); | 1146 | todoview_action->addTo( viewToolBar ); |
1143 | 1147 | ||
1144 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1148 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1145 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1149 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1146 | if (p-> mShowIconBackFast) { | 1150 | if (p-> mShowIconBackFast) { |
1147 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1151 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1148 | connect( action, SIGNAL( activated() ), | 1152 | connect( action, SIGNAL( activated() ), |
1149 | mView, SLOT( goPreviousMonth() ) ); | 1153 | mView, SLOT( goPreviousMonth() ) ); |
1150 | action->addTo( navigatorToolBar ); | 1154 | action->addTo( navigatorToolBar ); |
1151 | } | 1155 | } |
1152 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1156 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1153 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1157 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1154 | if (p-> mShowIconBack) { | 1158 | if (p-> mShowIconBack) { |
1155 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1159 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1156 | connect( action, SIGNAL( activated() ), | 1160 | connect( action, SIGNAL( activated() ), |
1157 | mView, SLOT( goPrevious() ) ); | 1161 | mView, SLOT( goPrevious() ) ); |
1158 | action->addTo( navigatorToolBar ); | 1162 | action->addTo( navigatorToolBar ); |
1159 | } | 1163 | } |
1160 | icon = loadPixmap( pathString + "today" ); | 1164 | icon = loadPixmap( pathString + "today" ); |
1161 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1165 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1162 | if (p-> mShowIconToday) | 1166 | if (p-> mShowIconToday) |
1163 | today_action->addTo( navigatorToolBar ); | 1167 | today_action->addTo( navigatorToolBar ); |
1164 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1168 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1165 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1169 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1166 | if (p-> mShowIconForward) { | 1170 | if (p-> mShowIconForward) { |
1167 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1171 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1168 | connect( action, SIGNAL( activated() ), | 1172 | connect( action, SIGNAL( activated() ), |
1169 | mView, SLOT( goNext() ) ); | 1173 | mView, SLOT( goNext() ) ); |
1170 | action->addTo( navigatorToolBar ); | 1174 | action->addTo( navigatorToolBar ); |
1171 | } | 1175 | } |
1172 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1176 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1173 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1177 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1174 | if (p-> mShowIconForwardFast) { | 1178 | if (p-> mShowIconForwardFast) { |
1175 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1179 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1176 | connect( action, SIGNAL( activated() ), | 1180 | connect( action, SIGNAL( activated() ), |
1177 | mView, SLOT( goNextMonth() ) ); | 1181 | mView, SLOT( goNextMonth() ) ); |
1178 | action->addTo( navigatorToolBar ); | 1182 | action->addTo( navigatorToolBar ); |
1179 | } | 1183 | } |
1180 | 1184 | ||
1181 | 1185 | ||
1182 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1186 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1183 | 1187 | ||
1184 | 1188 | ||
1185 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1189 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1186 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1190 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1187 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1191 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1188 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1192 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1189 | 1193 | ||
1190 | if (p-> mShowIconNewEvent) | 1194 | if (p-> mShowIconNewEvent) |
1191 | configureToolBarMenu->setItemChecked( 10, true ); | 1195 | configureToolBarMenu->setItemChecked( 10, true ); |
1192 | if (p->mShowIconNewTodo ) | 1196 | if (p->mShowIconNewTodo ) |
1193 | configureToolBarMenu->setItemChecked( 20, true ); | 1197 | configureToolBarMenu->setItemChecked( 20, true ); |
1194 | if (p-> mShowIconSearch) | 1198 | if (p-> mShowIconSearch) |
1195 | configureToolBarMenu->setItemChecked( 120, true ); | 1199 | configureToolBarMenu->setItemChecked( 120, true ); |
1196 | if (p-> mShowIconList) | 1200 | if (p-> mShowIconList) |
1197 | configureToolBarMenu->setItemChecked( 30, true ); | 1201 | configureToolBarMenu->setItemChecked( 30, true ); |
1198 | if (p-> mShowIconDay1) | 1202 | if (p-> mShowIconDay1) |
1199 | configureToolBarMenu->setItemChecked( 40, true ); | 1203 | configureToolBarMenu->setItemChecked( 40, true ); |
1200 | if (p-> mShowIconDay5) | 1204 | if (p-> mShowIconDay5) |
1201 | configureToolBarMenu->setItemChecked( 50, true ); | 1205 | configureToolBarMenu->setItemChecked( 50, true ); |
1202 | if (p-> mShowIconDay6) | 1206 | if (p-> mShowIconDay6) |
1203 | configureToolBarMenu->setItemChecked( 75, true ); | 1207 | configureToolBarMenu->setItemChecked( 75, true ); |
1204 | if (p-> mShowIconDay7) | 1208 | if (p-> mShowIconDay7) |
1205 | configureToolBarMenu->setItemChecked( 60, true ); | 1209 | configureToolBarMenu->setItemChecked( 60, true ); |
1206 | if (p-> mShowIconMonth) | 1210 | if (p-> mShowIconMonth) |
1207 | configureToolBarMenu->setItemChecked( 70, true ); | 1211 | configureToolBarMenu->setItemChecked( 70, true ); |
1208 | if (p-> mShowIconTodoview) | 1212 | if (p-> mShowIconTodoview) |
1209 | configureToolBarMenu->setItemChecked( 80, true ); | 1213 | configureToolBarMenu->setItemChecked( 80, true ); |
1210 | if (p-> mShowIconBackFast) | 1214 | if (p-> mShowIconBackFast) |
1211 | configureToolBarMenu->setItemChecked( 200, true ); | 1215 | configureToolBarMenu->setItemChecked( 200, true ); |
1212 | if (p-> mShowIconBack) | 1216 | if (p-> mShowIconBack) |
1213 | configureToolBarMenu->setItemChecked( 210, true ); | 1217 | configureToolBarMenu->setItemChecked( 210, true ); |
1214 | if (p-> mShowIconToday) | 1218 | if (p-> mShowIconToday) |
1215 | configureToolBarMenu->setItemChecked( 130, true ); | 1219 | configureToolBarMenu->setItemChecked( 130, true ); |
1216 | if (p-> mShowIconForward) | 1220 | if (p-> mShowIconForward) |
1217 | configureToolBarMenu->setItemChecked( 220, true ); | 1221 | configureToolBarMenu->setItemChecked( 220, true ); |
1218 | if (p-> mShowIconForwardFast) | 1222 | if (p-> mShowIconForwardFast) |
1219 | configureToolBarMenu->setItemChecked( 230, true ); | 1223 | configureToolBarMenu->setItemChecked( 230, true ); |
1220 | if (p-> mShowIconNextDays) | 1224 | if (p-> mShowIconNextDays) |
1221 | configureToolBarMenu->setItemChecked( 100, true ); | 1225 | configureToolBarMenu->setItemChecked( 100, true ); |
1222 | if (p-> mShowIconNext) | 1226 | if (p-> mShowIconNext) |
1223 | configureToolBarMenu->setItemChecked( 110, true ); | 1227 | configureToolBarMenu->setItemChecked( 110, true ); |
1224 | if (p-> mShowIconJournal) | 1228 | if (p-> mShowIconJournal) |
1225 | configureToolBarMenu->setItemChecked( 90, true ); | 1229 | configureToolBarMenu->setItemChecked( 90, true ); |
1226 | if (p-> mShowIconWhatsThis) | 1230 | if (p-> mShowIconWhatsThis) |
1227 | configureToolBarMenu->setItemChecked( 300, true ); | 1231 | configureToolBarMenu->setItemChecked( 300, true ); |
1228 | if (p-> mShowIconWeekNum) | 1232 | if (p-> mShowIconWeekNum) |
1229 | configureToolBarMenu->setItemChecked( 400, true ); | 1233 | configureToolBarMenu->setItemChecked( 400, true ); |
1230 | if (!p-> mShowIconStretch) { | 1234 | if (!p-> mShowIconStretch) { |
1231 | QLabel* dummy = new QLabel( iconToolBar ); | 1235 | QLabel* dummy = new QLabel( iconToolBar ); |
1232 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1236 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1233 | dummy->setMinimumWidth( 0 ); | 1237 | dummy->setMinimumWidth( 0 ); |
1234 | iconToolBar->setStretchableWidget ( dummy ) ; | 1238 | iconToolBar->setStretchableWidget ( dummy ) ; |
1235 | } | 1239 | } |
1236 | else { | 1240 | else { |
1237 | iconToolBar->setHorizontalStretchable (true ); | 1241 | iconToolBar->setHorizontalStretchable (true ); |
1238 | viewToolBar->setHorizontalStretchable (true ); | 1242 | viewToolBar->setHorizontalStretchable (true ); |
1239 | navigatorToolBar->setHorizontalStretchable (true ); | 1243 | navigatorToolBar->setHorizontalStretchable (true ); |
1240 | iconToolBar->setVerticalStretchable (true ); | 1244 | iconToolBar->setVerticalStretchable (true ); |
1241 | viewToolBar->setVerticalStretchable (true ); | 1245 | viewToolBar->setVerticalStretchable (true ); |
1242 | navigatorToolBar->setVerticalStretchable (true ); | 1246 | navigatorToolBar->setVerticalStretchable (true ); |
1243 | configureToolBarMenu->setItemChecked( 5, true ); | 1247 | configureToolBarMenu->setItemChecked( 5, true ); |
1244 | } | 1248 | } |
1245 | if (p-> mShowIconFilter) | 1249 | if (p-> mShowIconFilter) |
1246 | configureToolBarMenu->setItemChecked( 7, true ); | 1250 | configureToolBarMenu->setItemChecked( 7, true ); |
1247 | if (p-> mShowIconOnetoolbar) | 1251 | if (p-> mShowIconOnetoolbar) |
1248 | configureToolBarMenu->setItemChecked( 6, true ); | 1252 | configureToolBarMenu->setItemChecked( 6, true ); |
1249 | 1253 | ||
1250 | 1254 | ||
1251 | if ( filterMenubar ) | 1255 | if ( filterMenubar ) |
1252 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1256 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); |
1253 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1257 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1254 | configureAgenda( p->mHourSize ); | 1258 | configureAgenda( p->mHourSize ); |
1255 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1259 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1256 | } | 1260 | } |
1257 | 1261 | ||
1258 | void MainWindow::exportToPhone( int mode ) | 1262 | void MainWindow::exportToPhone( int mode ) |
1259 | { | 1263 | { |
1260 | 1264 | ||
1261 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1265 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1262 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1266 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1263 | KOex2phonePrefs ex2phone; | 1267 | KOex2phonePrefs ex2phone; |
1264 | 1268 | ||
1265 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1269 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1266 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1270 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1267 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1271 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1268 | if ( mode == 1 ) | 1272 | if ( mode == 1 ) |
1269 | ex2phone.setCaption(i18n("Export complete calendar")); | 1273 | ex2phone.setCaption(i18n("Export complete calendar")); |
1270 | if ( mode == 2 ) | 1274 | if ( mode == 2 ) |
1271 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1275 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1272 | 1276 | ||
1273 | if ( !ex2phone.exec() ) { | 1277 | if ( !ex2phone.exec() ) { |
1274 | return; | 1278 | return; |
1275 | } | 1279 | } |
1276 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1280 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1277 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1281 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1278 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1282 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1279 | 1283 | ||
1280 | int inFuture = 0; | 1284 | int inFuture = 0; |
1281 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1285 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1282 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1286 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1283 | QPtrList<Incidence> delSel; | 1287 | QPtrList<Incidence> delSel; |
1284 | if ( mode == 1 ) | 1288 | if ( mode == 1 ) |
1285 | delSel = mCalendar->rawIncidences(); | 1289 | delSel = mCalendar->rawIncidences(); |
1286 | if ( mode == 2 ) | 1290 | if ( mode == 2 ) |
1287 | delSel = mCalendar->incidences(); | 1291 | delSel = mCalendar->incidences(); |
1288 | CalendarLocal* cal = new CalendarLocal(); | 1292 | CalendarLocal* cal = new CalendarLocal(); |
1289 | cal->setLocalTime(); | 1293 | cal->setLocalTime(); |
1290 | Incidence *incidence = delSel.first(); | 1294 | Incidence *incidence = delSel.first(); |
1291 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1295 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1292 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1296 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1293 | while ( incidence ) { | 1297 | while ( incidence ) { |
1294 | if ( incidence->type() != "Journal" ) { | 1298 | if ( incidence->type() != "Journal" ) { |
1295 | bool add = true; | 1299 | bool add = true; |
1296 | if ( inFuture ) { | 1300 | if ( inFuture ) { |
1297 | QDateTime dt; | 1301 | QDateTime dt; |
1298 | if ( incidence->type() == "Todo" ) { | 1302 | if ( incidence->type() == "Todo" ) { |
1299 | Todo * t = (Todo*)incidence; | 1303 | Todo * t = (Todo*)incidence; |
1300 | if ( t->hasDueDate() ) | 1304 | if ( t->hasDueDate() ) |
1301 | dt = t->dtDue(); | 1305 | dt = t->dtDue(); |
@@ -1454,910 +1458,955 @@ void MainWindow::keyBindings() | |||
1454 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1458 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1455 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1459 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1456 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1460 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1457 | i18n("<p><h3>In list view:</h3></p>\n") + | 1461 | i18n("<p><h3>In list view:</h3></p>\n") + |
1458 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1462 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1459 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1463 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1460 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1464 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1461 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1465 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1462 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1466 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1463 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1467 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1464 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1468 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1465 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1469 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1466 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1470 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1467 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1471 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1468 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1472 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1469 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1473 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1470 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1474 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1471 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1475 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1472 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1476 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1473 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1477 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1474 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1478 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1475 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1479 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1476 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1480 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1477 | displayText( text, cap); | 1481 | displayText( text, cap); |
1478 | } | 1482 | } |
1479 | void MainWindow::aboutAutoSaving() | 1483 | void MainWindow::aboutAutoSaving() |
1480 | { | 1484 | { |
1481 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1485 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1482 | 1486 | ||
1483 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1487 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1484 | 1488 | ||
1485 | } | 1489 | } |
1486 | void MainWindow::aboutKnownBugs() | 1490 | void MainWindow::aboutKnownBugs() |
1487 | { | 1491 | { |
1488 | QMessageBox* msg; | 1492 | QMessageBox* msg; |
1489 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1493 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1490 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1494 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1491 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1495 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1492 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1496 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1493 | i18n("\nor report them in the bugtracker on\n") + | 1497 | i18n("\nor report them in the bugtracker on\n") + |
1494 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1498 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1495 | QMessageBox::NoIcon, | 1499 | QMessageBox::NoIcon, |
1496 | QMessageBox::Ok, | 1500 | QMessageBox::Ok, |
1497 | QMessageBox::NoButton, | 1501 | QMessageBox::NoButton, |
1498 | QMessageBox::NoButton); | 1502 | QMessageBox::NoButton); |
1499 | msg->exec(); | 1503 | msg->exec(); |
1500 | delete msg; | 1504 | delete msg; |
1501 | 1505 | ||
1502 | } | 1506 | } |
1503 | 1507 | ||
1504 | QString MainWindow::defaultFileName() | 1508 | QString MainWindow::defaultFileName() |
1505 | { | 1509 | { |
1506 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1510 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1507 | } | 1511 | } |
1508 | QString MainWindow::syncFileName() | 1512 | QString MainWindow::syncFileName() |
1509 | { | 1513 | { |
1510 | #ifdef DESKTOP_VERSION | 1514 | #ifdef DESKTOP_VERSION |
1511 | return locateLocal( "tmp", "synccalendar.ics" ); | 1515 | return locateLocal( "tmp", "synccalendar.ics" ); |
1512 | #else | 1516 | #else |
1513 | return QString( "/tmp/synccalendar.ics" ); | 1517 | return QString( "/tmp/synccalendar.ics" ); |
1514 | #endif | 1518 | #endif |
1515 | } | 1519 | } |
1516 | #include "koglobals.h" | 1520 | #include "koglobals.h" |
1517 | #include <kcalendarsystem.h> | 1521 | #include <kcalendarsystem.h> |
1518 | void MainWindow::updateWeek(QDate seda) | 1522 | void MainWindow::updateWeek(QDate seda) |
1519 | { | 1523 | { |
1520 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1524 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1521 | mWeekPixmap.fill( mWeekBgColor ); | 1525 | mWeekPixmap.fill( mWeekBgColor ); |
1522 | QPainter p ( &mWeekPixmap ); | 1526 | QPainter p ( &mWeekPixmap ); |
1523 | p.setFont( mWeekFont ); | 1527 | p.setFont( mWeekFont ); |
1524 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1528 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1525 | p.end(); | 1529 | p.end(); |
1526 | QIconSet icon3 ( mWeekPixmap ); | 1530 | QIconSet icon3 ( mWeekPixmap ); |
1527 | mWeekAction->setIconSet ( icon3 ); | 1531 | mWeekAction->setIconSet ( icon3 ); |
1528 | 1532 | ||
1529 | } | 1533 | } |
1530 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1534 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1531 | { | 1535 | { |
1532 | updateWeek( selectedDates.first() ); | 1536 | updateWeek( selectedDates.first() ); |
1533 | } | 1537 | } |
1534 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1538 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1535 | { | 1539 | { |
1536 | 1540 | ||
1537 | if ( !incidence ) { | 1541 | if ( !incidence ) { |
1538 | enableIncidenceActions( false ); | 1542 | enableIncidenceActions( false ); |
1539 | 1543 | ||
1540 | mNewSubTodoAction->setEnabled( false ); | 1544 | mNewSubTodoAction->setEnabled( false ); |
1541 | setCaptionToDates(); | 1545 | setCaptionToDates(); |
1542 | return; | 1546 | return; |
1543 | 1547 | ||
1544 | } | 1548 | } |
1545 | 1549 | ||
1546 | //KGlobal::locale()->formatDateTime(nextA, true); | 1550 | //KGlobal::locale()->formatDateTime(nextA, true); |
1547 | QString startString = ""; | 1551 | QString startString = ""; |
1548 | if ( incidence->type() != "Todo" ) { | 1552 | if ( incidence->type() != "Todo" ) { |
1549 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1553 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1550 | if ( incidence->doesFloat() ) { | 1554 | if ( incidence->doesFloat() ) { |
1551 | startString += ": "+incidence->dtStartDateStr( true ); | 1555 | startString += ": "+incidence->dtStartDateStr( true ); |
1552 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1556 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1553 | 1557 | ||
1554 | } else { | 1558 | } else { |
1555 | startString = ": "+incidence->dtStartStr(true); | 1559 | startString = ": "+incidence->dtStartStr(true); |
1556 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1560 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1557 | 1561 | ||
1558 | } | 1562 | } |
1559 | 1563 | ||
1560 | } else { | 1564 | } else { |
1561 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1565 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1562 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1566 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1563 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1567 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1564 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1568 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1565 | bool ok; | 1569 | bool ok; |
1566 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1570 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1567 | if ( ok ) { | 1571 | if ( ok ) { |
1568 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1572 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1569 | startString += i18n(" (%1 y.)"). arg( years ); | 1573 | startString += i18n(" (%1 y.)"). arg( years ); |
1570 | } | 1574 | } |
1571 | } | 1575 | } |
1572 | else | 1576 | else |
1573 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1577 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1574 | } | 1578 | } |
1575 | 1579 | ||
1576 | } | 1580 | } |
1577 | else | 1581 | else |
1578 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1582 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1579 | if ( !incidence->location().isEmpty() ) | 1583 | if ( !incidence->location().isEmpty() ) |
1580 | startString += " (" +incidence->location()+")"; | 1584 | startString += " (" +incidence->location()+")"; |
1581 | setCaption( incidence->summary()+startString); | 1585 | setCaption( incidence->summary()+startString); |
1582 | 1586 | ||
1583 | enableIncidenceActions( true ); | 1587 | enableIncidenceActions( true ); |
1584 | 1588 | ||
1585 | if ( incidence->type() == "Event" ) { | 1589 | if ( incidence->type() == "Event" ) { |
1586 | mShowAction->setText( i18n("Show Event...") ); | 1590 | mShowAction->setText( i18n("Show Event...") ); |
1587 | mEditAction->setText( i18n("Edit Event...") ); | 1591 | mEditAction->setText( i18n("Edit Event...") ); |
1588 | mDeleteAction->setText( i18n("Delete Event...") ); | 1592 | mDeleteAction->setText( i18n("Delete Event...") ); |
1589 | 1593 | ||
1590 | mNewSubTodoAction->setEnabled( false ); | 1594 | mNewSubTodoAction->setEnabled( false ); |
1591 | } else if ( incidence->type() == "Todo" ) { | 1595 | } else if ( incidence->type() == "Todo" ) { |
1592 | mShowAction->setText( i18n("Show Todo...") ); | 1596 | mShowAction->setText( i18n("Show Todo...") ); |
1593 | mEditAction->setText( i18n("Edit Todo...") ); | 1597 | mEditAction->setText( i18n("Edit Todo...") ); |
1594 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1598 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1595 | 1599 | ||
1596 | mNewSubTodoAction->setEnabled( true ); | 1600 | mNewSubTodoAction->setEnabled( true ); |
1597 | } else { | 1601 | } else { |
1598 | mShowAction->setText( i18n("Show...") ); | 1602 | mShowAction->setText( i18n("Show...") ); |
1599 | mShowAction->setText( i18n("Edit...") ); | 1603 | mShowAction->setText( i18n("Edit...") ); |
1600 | mShowAction->setText( i18n("Delete...") ); | 1604 | mShowAction->setText( i18n("Delete...") ); |
1601 | 1605 | ||
1602 | mNewSubTodoAction->setEnabled( false ); | 1606 | mNewSubTodoAction->setEnabled( false ); |
1603 | } | 1607 | } |
1604 | } | 1608 | } |
1605 | 1609 | ||
1606 | void MainWindow::enableIncidenceActions( bool enabled ) | 1610 | void MainWindow::enableIncidenceActions( bool enabled ) |
1607 | { | 1611 | { |
1608 | mShowAction->setEnabled( enabled ); | 1612 | mShowAction->setEnabled( enabled ); |
1609 | mEditAction->setEnabled( enabled ); | 1613 | mEditAction->setEnabled( enabled ); |
1610 | mDeleteAction->setEnabled( enabled ); | 1614 | mDeleteAction->setEnabled( enabled ); |
1611 | 1615 | ||
1612 | mCloneAction->setEnabled( enabled ); | 1616 | mCloneAction->setEnabled( enabled ); |
1613 | mMoveAction->setEnabled( enabled ); | 1617 | mMoveAction->setEnabled( enabled ); |
1614 | mBeamAction->setEnabled( enabled ); | 1618 | mBeamAction->setEnabled( enabled ); |
1615 | mCancelAction->setEnabled( enabled ); | 1619 | mCancelAction->setEnabled( enabled ); |
1616 | } | 1620 | } |
1617 | 1621 | ||
1618 | void MainWindow::importOL() | 1622 | void MainWindow::importOL() |
1619 | { | 1623 | { |
1620 | #ifdef _OL_IMPORT_ | 1624 | #ifdef _OL_IMPORT_ |
1621 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1625 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1622 | id->exec(); | 1626 | id->exec(); |
1623 | delete id; | 1627 | delete id; |
1624 | mView->updateView(); | 1628 | mView->updateView(); |
1625 | #endif | 1629 | #endif |
1626 | } | 1630 | } |
1627 | void MainWindow::importBday() | 1631 | void MainWindow::importBday() |
1628 | { | 1632 | { |
1629 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1633 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1630 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1634 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1631 | i18n("Import!"), i18n("Cancel"), 0, | 1635 | i18n("Import!"), i18n("Cancel"), 0, |
1632 | 0, 1 ); | 1636 | 0, 1 ); |
1633 | if ( result == 0 ) { | 1637 | if ( result == 0 ) { |
1634 | mView->importBday(); | 1638 | mView->importBday(); |
1635 | 1639 | ||
1636 | } | 1640 | } |
1637 | 1641 | ||
1638 | 1642 | ||
1639 | } | 1643 | } |
1640 | void MainWindow::importQtopia() | 1644 | void MainWindow::importQtopia() |
1641 | { | 1645 | { |
1642 | //#ifndef DESKTOP_VERSION | 1646 | //#ifndef DESKTOP_VERSION |
1643 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1647 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1644 | #ifdef DESKTOP_VERSION | 1648 | #ifdef DESKTOP_VERSION |
1645 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1649 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1646 | #endif | 1650 | #endif |
1647 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1651 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1648 | i18n("Import!"), i18n("Cancel"), 0, | 1652 | i18n("Import!"), i18n("Cancel"), 0, |
1649 | 0, 1 ); | 1653 | 0, 1 ); |
1650 | if ( result == 0 ) { | 1654 | if ( result == 0 ) { |
1651 | #ifndef DESKTOP_VERSION | 1655 | #ifndef DESKTOP_VERSION |
1652 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1656 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1653 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1657 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1654 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1658 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1655 | #else | 1659 | #else |
1656 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1660 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1657 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1661 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1658 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1662 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1659 | #endif | 1663 | #endif |
1660 | mView->importQtopia( categories, datebook, todolist ); | 1664 | mView->importQtopia( categories, datebook, todolist ); |
1661 | } | 1665 | } |
1662 | #if 0 | 1666 | #if 0 |
1663 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1667 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1664 | i18n("Not supported \non desktop!\n"), | 1668 | i18n("Not supported \non desktop!\n"), |
1665 | i18n("Ok"), i18n("Cancel"), 0, | 1669 | i18n("Ok"), i18n("Cancel"), 0, |
1666 | 0, 1 ); | 1670 | 0, 1 ); |
1667 | 1671 | ||
1668 | #endif | 1672 | #endif |
1669 | } | 1673 | } |
1670 | 1674 | ||
1671 | void MainWindow::saveOnClose() | 1675 | void MainWindow::saveOnClose() |
1672 | { | 1676 | { |
1673 | KOPrefs *p = KOPrefs::instance(); | 1677 | KOPrefs *p = KOPrefs::instance(); |
1674 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1678 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1675 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1679 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1676 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1680 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1677 | if ( filterToolBar ) { | 1681 | if ( filterToolBar ) { |
1678 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1682 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1679 | } | 1683 | } |
1680 | #ifdef DESKTOP_VERSION | 1684 | #ifdef DESKTOP_VERSION |
1681 | 1685 | ||
1682 | QPoint myP; | 1686 | QPoint myP; |
1683 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1687 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1684 | if ( p->mToolBarHor ) | 1688 | if ( p->mToolBarHor ) |
1685 | p->mToolBarUp = myP.y() > height()/2; | 1689 | p->mToolBarUp = myP.y() > height()/2; |
1686 | else | 1690 | else |
1687 | p->mToolBarUp = myP.x() > width()/2; | 1691 | p->mToolBarUp = myP.x() > width()/2; |
1688 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1692 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1689 | if ( p->mToolBarHorV ) | 1693 | if ( p->mToolBarHorV ) |
1690 | p->mToolBarUpV = myP.y() > height()/2; | 1694 | p->mToolBarUpV = myP.y() > height()/2; |
1691 | else | 1695 | else |
1692 | p->mToolBarUpV = myP.x() > width()/2 ; | 1696 | p->mToolBarUpV = myP.x() > width()/2 ; |
1693 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1697 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1694 | if ( p->mToolBarHorN ) | 1698 | if ( p->mToolBarHorN ) |
1695 | p->mToolBarUpN = myP.y() > height()/2; | 1699 | p->mToolBarUpN = myP.y() > height()/2; |
1696 | else | 1700 | else |
1697 | p->mToolBarUpN = myP.x() > width()/2 ; | 1701 | p->mToolBarUpN = myP.x() > width()/2 ; |
1698 | if ( filterToolBar ) { | 1702 | if ( filterToolBar ) { |
1699 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1703 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1700 | if ( p->mToolBarHorF ) | 1704 | if ( p->mToolBarHorF ) |
1701 | p->mToolBarUpF = myP.y() > height()/2; | 1705 | p->mToolBarUpF = myP.y() > height()/2; |
1702 | else | 1706 | else |
1703 | p->mToolBarUpF = myP.x() > width()/2 ; | 1707 | p->mToolBarUpF = myP.x() > width()/2 ; |
1704 | } | 1708 | } |
1705 | #else | 1709 | #else |
1706 | if ( p->mToolBarHor ) | 1710 | if ( p->mToolBarHor ) |
1707 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1711 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1708 | else | 1712 | else |
1709 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1713 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1710 | if ( p->mToolBarHorV ) | 1714 | if ( p->mToolBarHorV ) |
1711 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1715 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1712 | else | 1716 | else |
1713 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1717 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1714 | 1718 | ||
1715 | if ( p->mToolBarHorN ) | 1719 | if ( p->mToolBarHorN ) |
1716 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1720 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1717 | else | 1721 | else |
1718 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1722 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1719 | if ( filterToolBar ) { | 1723 | if ( filterToolBar ) { |
1720 | if ( p->mToolBarHorF ) | 1724 | if ( p->mToolBarHorF ) |
1721 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1725 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1722 | else | 1726 | else |
1723 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1727 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1724 | } | 1728 | } |
1725 | #endif | 1729 | #endif |
1726 | 1730 | ||
1727 | 1731 | ||
1728 | mView->writeSettings(); | 1732 | mView->writeSettings(); |
1729 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1733 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1730 | save(); | 1734 | save(); |
1731 | } | 1735 | } |
1732 | void MainWindow::slotModifiedChanged( bool changed ) | 1736 | void MainWindow::slotModifiedChanged( bool changed ) |
1733 | { | 1737 | { |
1734 | if ( mBlockAtStartup ) | 1738 | if ( mBlockAtStartup ) |
1735 | return; | 1739 | return; |
1736 | 1740 | ||
1737 | int msec; | 1741 | int msec; |
1738 | // we store the changes after 1 minute, | 1742 | // we store the changes after 1 minute, |
1739 | // and for safety reasons after 10 minutes again | 1743 | // and for safety reasons after 10 minutes again |
1740 | if ( !mSyncManager->blockSave() ) | 1744 | if ( !mSyncManager->blockSave() ) |
1741 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1745 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1742 | else | 1746 | else |
1743 | msec = 1000 * 600; | 1747 | msec = 1000 * 600; |
1744 | mSaveTimer.start( msec, true ); // 1 minute | 1748 | mSaveTimer.start( msec, true ); // 1 minute |
1745 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1749 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1746 | mCalendarModifiedFlag = true; | 1750 | mCalendarModifiedFlag = true; |
1747 | } | 1751 | } |
1748 | void MainWindow::saveStopTimer() | 1752 | void MainWindow::saveStopTimer() |
1749 | { | 1753 | { |
1750 | mSaveTimer.stop(); | 1754 | mSaveTimer.stop(); |
1751 | if (mSaveTimer.isActive() ) | 1755 | if (mSaveTimer.isActive() ) |
1752 | qDebug("ti active "); | 1756 | qDebug("ti active "); |
1753 | else | 1757 | else |
1754 | qDebug("KO: Save timer stopped"); | 1758 | qDebug("KO: Save timer stopped"); |
1755 | } | 1759 | } |
1756 | void MainWindow::save() | 1760 | void MainWindow::save() |
1757 | { | 1761 | { |
1758 | if ( !mCalendarModifiedFlag ) { | 1762 | if ( !mCalendarModifiedFlag ) { |
1759 | qDebug("KO: Calendar not modified. Nothing saved."); | 1763 | qDebug("KO: Calendar not modified. Nothing saved."); |
1760 | return; | 1764 | return; |
1761 | } | 1765 | } |
1762 | if ( mSyncManager->blockSave() ) | 1766 | if ( mSyncManager->blockSave() ) |
1763 | return; | 1767 | return; |
1764 | mSyncManager->setBlockSave(true); | 1768 | mSyncManager->setBlockSave(true); |
1765 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1769 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1766 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1770 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1767 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1771 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1768 | qDebug("KO: Start saving data to file!"); | 1772 | qDebug("KO: Start saving data to file!"); |
1769 | mView->saveCalendar( defaultFileName() ); | 1773 | mView->saveCalendar( defaultFileName() ); |
1770 | mCalendarModifiedFlag = false; | 1774 | mCalendarModifiedFlag = false; |
1771 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1775 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1772 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1776 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1773 | QString savemes; | 1777 | QString savemes; |
1774 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1778 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1775 | setCaption(savemes); | 1779 | setCaption(savemes); |
1776 | } else | 1780 | } else |
1777 | setCaption(i18n("Saving cancelled!")); | 1781 | setCaption(i18n("Saving cancelled!")); |
1778 | mSyncManager->setBlockSave( false ); | 1782 | mSyncManager->setBlockSave( false ); |
1779 | } | 1783 | } |
1780 | 1784 | ||
1781 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1785 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1782 | { | 1786 | { |
1783 | if ( !e->isAutoRepeat() ) { | 1787 | if ( !e->isAutoRepeat() ) { |
1784 | mFlagKeyPressed = false; | 1788 | mFlagKeyPressed = false; |
1785 | } | 1789 | } |
1786 | } | 1790 | } |
1787 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1791 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1788 | { | 1792 | { |
1789 | qApp->processEvents(); | 1793 | qApp->processEvents(); |
1790 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1794 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1791 | e->ignore(); | 1795 | e->ignore(); |
1792 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1796 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1793 | return; | 1797 | return; |
1794 | } | 1798 | } |
1795 | if (! e->isAutoRepeat() ) | 1799 | if (! e->isAutoRepeat() ) |
1796 | mFlagKeyPressed = true; | 1800 | mFlagKeyPressed = true; |
1797 | KOPrefs *p = KOPrefs::instance(); | 1801 | KOPrefs *p = KOPrefs::instance(); |
1798 | bool showSelectedDates = false; | 1802 | bool showSelectedDates = false; |
1799 | int size; | 1803 | int size; |
1800 | int pro = 0; | 1804 | int pro = 0; |
1801 | //qDebug("MainWindow::keyPressEvent "); | 1805 | //qDebug("MainWindow::keyPressEvent "); |
1802 | switch ( e->key() ) { | 1806 | switch ( e->key() ) { |
1803 | case Qt::Key_Right: | 1807 | case Qt::Key_Right: |
1804 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1808 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1805 | mView->goNextMonth(); | 1809 | mView->goNextMonth(); |
1806 | else | 1810 | else |
1807 | mView->goNext(); | 1811 | mView->goNext(); |
1808 | showSelectedDates = true; | 1812 | showSelectedDates = true; |
1809 | break; | 1813 | break; |
1810 | case Qt::Key_Left: | 1814 | case Qt::Key_Left: |
1811 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1815 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1812 | mView->goPreviousMonth(); | 1816 | mView->goPreviousMonth(); |
1813 | else | 1817 | else |
1814 | mView->goPrevious(); | 1818 | mView->goPrevious(); |
1815 | showSelectedDates = true; | 1819 | showSelectedDates = true; |
1816 | break; | 1820 | break; |
1817 | case Qt::Key_Down: | 1821 | case Qt::Key_Down: |
1818 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1822 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1819 | break; | 1823 | break; |
1820 | case Qt::Key_Up: | 1824 | case Qt::Key_Up: |
1821 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1825 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1822 | break; | 1826 | break; |
1823 | case Qt::Key_K: | 1827 | case Qt::Key_K: |
1824 | mView->viewManager()->showMonthViewWeek(); | 1828 | mView->viewManager()->showMonthViewWeek(); |
1825 | break; | 1829 | break; |
1826 | case Qt::Key_I: | 1830 | case Qt::Key_I: |
1827 | mView->showIncidence(); | 1831 | mView->showIncidence(); |
1828 | break; | 1832 | break; |
1829 | case Qt::Key_Delete: | 1833 | case Qt::Key_Delete: |
1830 | case Qt::Key_Backspace: | 1834 | case Qt::Key_Backspace: |
1831 | mView->deleteIncidence(); | 1835 | mView->deleteIncidence(); |
1832 | break; | 1836 | break; |
1833 | case Qt::Key_D: | 1837 | case Qt::Key_D: |
1834 | mView->viewManager()->showDayView(); | 1838 | mView->viewManager()->showDayView(); |
1835 | showSelectedDates = true; | 1839 | showSelectedDates = true; |
1836 | break; | 1840 | break; |
1837 | case Qt::Key_O: | 1841 | case Qt::Key_O: |
1838 | mView->toggleFilerEnabled( ); | 1842 | mView->toggleFilerEnabled( ); |
1839 | break; | 1843 | break; |
1840 | case Qt::Key_0: | 1844 | case Qt::Key_0: |
1841 | case Qt::Key_1: | 1845 | case Qt::Key_1: |
1842 | case Qt::Key_2: | 1846 | case Qt::Key_2: |
1843 | case Qt::Key_3: | 1847 | case Qt::Key_3: |
1844 | case Qt::Key_4: | 1848 | case Qt::Key_4: |
1845 | case Qt::Key_5: | 1849 | case Qt::Key_5: |
1846 | case Qt::Key_6: | 1850 | case Qt::Key_6: |
1847 | case Qt::Key_7: | 1851 | case Qt::Key_7: |
1848 | case Qt::Key_8: | 1852 | case Qt::Key_8: |
1849 | case Qt::Key_9: | 1853 | case Qt::Key_9: |
1850 | pro = e->key()-48; | 1854 | pro = e->key()-48; |
1851 | if ( pro == 0 ) | 1855 | if ( pro == 0 ) |
1852 | pro = 10; | 1856 | pro = 10; |
1853 | if ( e->state() == Qt::ControlButton) | 1857 | if ( e->state() == Qt::ControlButton) |
1854 | pro += 10; | 1858 | pro += 10; |
1855 | break; | 1859 | break; |
1856 | case Qt::Key_M: | 1860 | case Qt::Key_M: |
1857 | mView->viewManager()->showMonthView(); | 1861 | mView->viewManager()->showMonthView(); |
1858 | showSelectedDates = true; | 1862 | showSelectedDates = true; |
1859 | break; | 1863 | break; |
1860 | case Qt::Key_Insert: | 1864 | case Qt::Key_Insert: |
1861 | mView->newEvent(); | 1865 | mView->newEvent(); |
1862 | break; | 1866 | break; |
1863 | case Qt::Key_S : | 1867 | case Qt::Key_S : |
1864 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1868 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1865 | mView->newSubTodo(); | 1869 | mView->newSubTodo(); |
1866 | else | 1870 | else |
1867 | mView->dialogManager()->showSearchDialog(); | 1871 | mView->dialogManager()->showSearchDialog(); |
1868 | break; | 1872 | break; |
1869 | case Qt::Key_Y : | 1873 | case Qt::Key_Y : |
1870 | case Qt::Key_Z : | 1874 | case Qt::Key_Z : |
1871 | mView->viewManager()->showWorkWeekView(); | 1875 | mView->viewManager()->showWorkWeekView(); |
1872 | showSelectedDates = true; | 1876 | showSelectedDates = true; |
1873 | break; | 1877 | break; |
1874 | case Qt::Key_U : | 1878 | case Qt::Key_U : |
1875 | mView->viewManager()->showWeekView(); | 1879 | mView->viewManager()->showWeekView(); |
1876 | showSelectedDates = true; | 1880 | showSelectedDates = true; |
1877 | break; | 1881 | break; |
1878 | case Qt::Key_H : | 1882 | case Qt::Key_H : |
1879 | keyBindings(); | 1883 | keyBindings(); |
1880 | break; | 1884 | break; |
1881 | case Qt::Key_W: | 1885 | case Qt::Key_W: |
1882 | mView->viewManager()->showWhatsNextView(); | 1886 | mView->viewManager()->showWhatsNextView(); |
1883 | break; | 1887 | break; |
1884 | case Qt::Key_L: | 1888 | case Qt::Key_L: |
1885 | mView->viewManager()->showListView(); | 1889 | mView->viewManager()->showListView(); |
1886 | break; | 1890 | break; |
1887 | case Qt::Key_N: | 1891 | case Qt::Key_N: |
1888 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1892 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1889 | mView->viewManager()->showNextView(); | 1893 | mView->viewManager()->showNextView(); |
1890 | else { | 1894 | else { |
1891 | mView->viewManager()->showNextXView(); | 1895 | mView->viewManager()->showNextXView(); |
1892 | showSelectedDates = true; | 1896 | showSelectedDates = true; |
1893 | } | 1897 | } |
1894 | break; | 1898 | break; |
1895 | case Qt::Key_V: | 1899 | case Qt::Key_V: |
1896 | mView->viewManager()->showTodoView(); | 1900 | mView->viewManager()->showTodoView(); |
1897 | break; | 1901 | break; |
1898 | case Qt::Key_C: | 1902 | case Qt::Key_C: |
1899 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1903 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1900 | break; | 1904 | break; |
1901 | case Qt::Key_P: | 1905 | case Qt::Key_P: |
1902 | mView->showDatePicker( ); | 1906 | mView->showDatePicker( ); |
1903 | break; | 1907 | break; |
1904 | case Qt::Key_F: | 1908 | case Qt::Key_F: |
1905 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1909 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1906 | mView->editFilters(); | 1910 | mView->editFilters(); |
1907 | else | 1911 | else |
1908 | mView->toggleFilter(); | 1912 | mView->toggleFilter(); |
1909 | break; | 1913 | break; |
1910 | case Qt::Key_X: | 1914 | case Qt::Key_X: |
1911 | mView->toggleDateNavigatorWidget(); | 1915 | mView->toggleDateNavigatorWidget(); |
1912 | break; | 1916 | break; |
1913 | case Qt::Key_Space: | 1917 | case Qt::Key_Space: |
1914 | mView->toggleExpand(); | 1918 | mView->toggleExpand(); |
1915 | break; | 1919 | break; |
1916 | case Qt::Key_A: | 1920 | case Qt::Key_A: |
1917 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 1921 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
1918 | mView->showNextAlarms(); | 1922 | mView->showNextAlarms(); |
1919 | else | 1923 | else |
1920 | mView->toggleAllDaySize(); | 1924 | mView->toggleAllDaySize(); |
1921 | break; | 1925 | break; |
1922 | case Qt::Key_T: | 1926 | case Qt::Key_T: |
1923 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1927 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1924 | mView->newTodo(); | 1928 | mView->newTodo(); |
1925 | else { | 1929 | else { |
1926 | mView->goToday(); | 1930 | mView->goToday(); |
1927 | showSelectedDates = true; | 1931 | showSelectedDates = true; |
1928 | } | 1932 | } |
1929 | break; | 1933 | break; |
1930 | case Qt::Key_J: | 1934 | case Qt::Key_J: |
1931 | mView->viewManager()->showJournalView(); | 1935 | mView->viewManager()->showJournalView(); |
1932 | break; | 1936 | break; |
1933 | case Qt::Key_B: | 1937 | case Qt::Key_B: |
1934 | mView->editIncidenceDescription();; | 1938 | mView->editIncidenceDescription();; |
1935 | break; | 1939 | break; |
1936 | // case Qt::Key_Return: | 1940 | // case Qt::Key_Return: |
1937 | case Qt::Key_E: | 1941 | case Qt::Key_E: |
1938 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1942 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1939 | mView->newEvent(); | 1943 | mView->newEvent(); |
1940 | else | 1944 | else |
1941 | mView->editIncidence(); | 1945 | mView->editIncidence(); |
1942 | break; | 1946 | break; |
1943 | case Qt::Key_Plus: | 1947 | case Qt::Key_Plus: |
1944 | size = p->mHourSize +2; | 1948 | size = p->mHourSize +2; |
1945 | if ( size <= 22 ) | 1949 | if ( size <= 22 ) |
1946 | configureAgenda( size ); | 1950 | configureAgenda( size ); |
1947 | break; | 1951 | break; |
1948 | case Qt::Key_Minus: | 1952 | case Qt::Key_Minus: |
1949 | size = p->mHourSize - 2; | 1953 | size = p->mHourSize - 2; |
1950 | if ( size >= 4 ) | 1954 | if ( size >= 4 ) |
1951 | configureAgenda( size ); | 1955 | configureAgenda( size ); |
1952 | break; | 1956 | break; |
1953 | 1957 | ||
1954 | 1958 | ||
1955 | default: | 1959 | default: |
1956 | e->ignore(); | 1960 | e->ignore(); |
1957 | } | 1961 | } |
1958 | if ( pro > 0 ) { | 1962 | if ( pro > 0 ) { |
1959 | mView->selectFilter( pro-1 ); | 1963 | mView->selectFilter( pro-1 ); |
1960 | } | 1964 | } |
1961 | if ( showSelectedDates ) { | 1965 | if ( showSelectedDates ) { |
1962 | ;// setCaptionToDates(); | 1966 | ;// setCaptionToDates(); |
1963 | } | 1967 | } |
1964 | 1968 | ||
1965 | } | 1969 | } |
1970 | void MainWindow::fillFilterMenuTB() | ||
1971 | { | ||
1972 | selectFilterMenuTB->clear(); | ||
1973 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | ||
1974 | selectFilterMenuTB->insertSeparator(); | ||
1975 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | ||
1976 | |||
1977 | selectFilterMenuTB->insertSeparator(); | ||
1978 | QPtrList<CalFilter> fili = mView->filters(); | ||
1979 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | ||
1980 | CalFilter *filter = fili.first(); | ||
1981 | int iii = 2; | ||
1982 | bool checkitem = mView->filterView()->filtersEnabled(); | ||
1983 | while(filter) { | ||
1984 | selectFilterMenuTB->insertItem( filter->name(), iii ); | ||
1985 | if ( filter == curfilter) | ||
1986 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | ||
1987 | filter = fili.next(); | ||
1988 | ++iii; | ||
1989 | } | ||
1990 | if ( !checkitem ) | ||
1991 | selectFilterMenuTB->setItemChecked( 1, true ); | ||
1966 | 1992 | ||
1993 | int x = 0; | ||
1994 | int y = iconToolBar->height(); | ||
1995 | int dX = 0; | ||
1996 | int dY = 0; | ||
1997 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | ||
1998 | if ( iconToolBar->y() > height()/2 ) { | ||
1999 | dY = selectFilterMenuTB->sizeHint().height()+8; | ||
2000 | y = 0; | ||
2001 | } | ||
2002 | } else { | ||
2003 | if ( iconToolBar->x() > width()/2 ) { // right side | ||
2004 | x=0; | ||
2005 | dX= selectFilterMenuTB->sizeHint().width()+8; | ||
2006 | y = 0; | ||
2007 | } else { | ||
2008 | x= iconToolBar->width(); | ||
2009 | y = 0; | ||
2010 | } | ||
2011 | } | ||
2012 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | ||
2013 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | ||
2014 | } | ||
1967 | void MainWindow::fillFilterMenu() | 2015 | void MainWindow::fillFilterMenu() |
1968 | { | 2016 | { |
1969 | selectFilterMenu->clear(); | 2017 | selectFilterMenu->clear(); |
1970 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2018 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1971 | selectFilterMenu->insertSeparator(); | 2019 | selectFilterMenu->insertSeparator(); |
1972 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2020 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
1973 | 2021 | ||
1974 | selectFilterMenu->insertSeparator(); | 2022 | selectFilterMenu->insertSeparator(); |
1975 | QPtrList<CalFilter> fili = mView->filters(); | 2023 | QPtrList<CalFilter> fili = mView->filters(); |
1976 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2024 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1977 | CalFilter *filter = fili.first(); | 2025 | CalFilter *filter = fili.first(); |
1978 | int iii = 2; | 2026 | int iii = 2; |
1979 | bool checkitem = mView->filterView()->filtersEnabled(); | 2027 | bool checkitem = mView->filterView()->filtersEnabled(); |
1980 | while(filter) { | 2028 | while(filter) { |
1981 | selectFilterMenu->insertItem( filter->name(), iii ); | 2029 | selectFilterMenu->insertItem( filter->name(), iii ); |
1982 | if ( filter == curfilter) | 2030 | if ( filter == curfilter) |
1983 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2031 | selectFilterMenu->setItemChecked( iii, checkitem ); |
1984 | filter = fili.next(); | 2032 | filter = fili.next(); |
1985 | ++iii; | 2033 | ++iii; |
1986 | } | 2034 | } |
1987 | if ( !checkitem ) | 2035 | if ( !checkitem ) |
1988 | selectFilterMenu->setItemChecked( 1, true ); | 2036 | selectFilterMenu->setItemChecked( 1, true ); |
1989 | } | 2037 | } |
1990 | void MainWindow::fillFilterMenuPopup() | 2038 | void MainWindow::fillFilterMenuPopup() |
1991 | { | 2039 | { |
1992 | filterPopupMenu->clear(); | 2040 | filterPopupMenu->clear(); |
1993 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2041 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
1994 | 2042 | ||
1995 | filterPopupMenu->insertSeparator(); | 2043 | filterPopupMenu->insertSeparator(); |
1996 | QPtrList<CalFilter> fili = mView->filters(); | 2044 | QPtrList<CalFilter> fili = mView->filters(); |
1997 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2045 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1998 | CalFilter *filter = fili.first(); | 2046 | CalFilter *filter = fili.first(); |
1999 | int iii = 1; | 2047 | int iii = 1; |
2000 | bool checkitem = mView->filterView()->filtersEnabled(); | 2048 | bool checkitem = mView->filterView()->filtersEnabled(); |
2001 | while(filter) { | 2049 | while(filter) { |
2002 | filterPopupMenu->insertItem( filter->name(), iii ); | 2050 | filterPopupMenu->insertItem( filter->name(), iii ); |
2003 | if ( filter == curfilter) | 2051 | if ( filter == curfilter) |
2004 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2052 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2005 | filter = fili.next(); | 2053 | filter = fili.next(); |
2006 | ++iii; | 2054 | ++iii; |
2007 | } | 2055 | } |
2008 | if ( !checkitem ) | 2056 | if ( !checkitem ) |
2009 | filterPopupMenu->setItemChecked( 0, true ); | 2057 | filterPopupMenu->setItemChecked( 0, true ); |
2010 | } | 2058 | } |
2011 | void MainWindow::selectFilter( int fil ) | 2059 | void MainWindow::selectFilter( int fil ) |
2012 | { | 2060 | { |
2013 | 2061 | ||
2014 | if ( fil == 0 ) { | 2062 | if ( fil == 0 ) { |
2015 | mView->editFilters( ); | 2063 | mView->editFilters( ); |
2016 | } else if ( fil == 1 ){ | 2064 | } else if ( fil == 1 ){ |
2017 | if ( mView->filterView()->filtersEnabled() ) | 2065 | if ( mView->filterView()->filtersEnabled() ) |
2018 | mView->toggleFilerEnabled( ); | 2066 | mView->toggleFilerEnabled( ); |
2019 | } else { | 2067 | } else { |
2020 | if ( !mView->filterView()->filtersEnabled() ) { | 2068 | if ( !mView->filterView()->filtersEnabled() ) { |
2021 | mView->filterView()->blockSignals( true ); | 2069 | mView->filterView()->blockSignals( true ); |
2022 | mView->toggleFilerEnabled( ); | 2070 | mView->toggleFilerEnabled( ); |
2023 | mView->filterView()->blockSignals( false ); | 2071 | mView->filterView()->blockSignals( false ); |
2024 | } | 2072 | } |
2025 | mView->selectFilter( fil-2 ); | 2073 | mView->selectFilter( fil-2 ); |
2026 | } | 2074 | } |
2027 | } | 2075 | } |
2028 | void MainWindow::updateFilterToolbar() | 2076 | void MainWindow::updateFilterToolbar() |
2029 | { | 2077 | { |
2030 | if ( filterMenubar ) { | 2078 | if ( filterMenubar ) { |
2031 | if ( !mView->filterView()->filtersEnabled() ) { | 2079 | if ( !mView->filterView()->filtersEnabled() ) { |
2032 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2080 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2033 | } else { | 2081 | } else { |
2034 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2082 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2035 | if ( curfilter ) { | 2083 | if ( curfilter ) { |
2036 | filterMenubar->changeItem( 0, curfilter->name() ); | 2084 | filterMenubar->changeItem( 0, curfilter->name() ); |
2037 | } | 2085 | } |
2038 | } | 2086 | } |
2039 | } | 2087 | } |
2040 | } | 2088 | } |
2041 | void MainWindow::selectFilterPopup( int fil ) | 2089 | void MainWindow::selectFilterPopup( int fil ) |
2042 | { | 2090 | { |
2043 | selectFilter( fil + 1 ); | 2091 | selectFilter( fil + 1 ); |
2044 | 2092 | ||
2045 | } | 2093 | } |
2046 | void MainWindow::configureToolBar( int item ) | 2094 | void MainWindow::configureToolBar( int item ) |
2047 | { | 2095 | { |
2048 | 2096 | ||
2049 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2097 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2050 | KOPrefs *p = KOPrefs::instance(); | 2098 | KOPrefs *p = KOPrefs::instance(); |
2051 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2099 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2052 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2100 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2053 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2101 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2054 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2102 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2055 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2103 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2056 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2104 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2057 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2105 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2058 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2106 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2059 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2107 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2060 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2108 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2061 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2109 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2062 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2110 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2063 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2111 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2064 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2112 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2065 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2113 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2066 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2114 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2067 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2115 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2068 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2116 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2069 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2117 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2070 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2118 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2071 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2119 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2072 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2120 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2073 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2121 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2074 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2122 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2075 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2123 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2076 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2124 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2077 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2125 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2078 | // initActions(); | 2126 | // initActions(); |
2079 | } | 2127 | } |
2080 | void MainWindow::setCaption ( const QString & c ) | 2128 | void MainWindow::setCaption ( const QString & c ) |
2081 | { | 2129 | { |
2082 | QString cap = c; | 2130 | QString cap = c; |
2083 | cap.replace( QRegExp("\n"), " " ); | 2131 | cap.replace( QRegExp("\n"), " " ); |
2084 | cap = cap.stripWhiteSpace(); | 2132 | cap = cap.stripWhiteSpace(); |
2085 | if ( cap.isEmpty() ) | 2133 | if ( cap.isEmpty() ) |
2086 | cap = "KO/Pi"; | 2134 | cap = "KO/Pi"; |
2087 | QWidget::setCaption( cap ); | 2135 | QWidget::setCaption( cap ); |
2088 | } | 2136 | } |
2089 | void MainWindow::setCaptionToDates() | 2137 | void MainWindow::setCaptionToDates() |
2090 | { | 2138 | { |
2091 | QString selDates; | 2139 | QString selDates; |
2092 | QDate date = mView->startDate(); | 2140 | QDate date = mView->startDate(); |
2093 | if ( ! date.isValid() ) { | 2141 | if ( ! date.isValid() ) { |
2094 | setCaption(""); | 2142 | setCaption(""); |
2095 | return; | 2143 | return; |
2096 | } | 2144 | } |
2097 | selDates = KGlobal::locale()->formatDate( date, true); | 2145 | selDates = KGlobal::locale()->formatDate( date, true); |
2098 | if (mView->startDate() < mView->endDate() ) | 2146 | if (mView->startDate() < mView->endDate() ) |
2099 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2147 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2100 | else { | 2148 | else { |
2101 | QString addString; | 2149 | QString addString; |
2102 | if ( date == QDateTime::currentDateTime().date() ) | 2150 | if ( date == QDateTime::currentDateTime().date() ) |
2103 | addString = i18n("Today"); | 2151 | addString = i18n("Today"); |
2104 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2152 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2105 | addString = i18n("Tomorrow"); | 2153 | addString = i18n("Tomorrow"); |
2106 | if ( !addString.isEmpty() ) | 2154 | if ( !addString.isEmpty() ) |
2107 | selDates = addString+", "+selDates ; | 2155 | selDates = addString+", "+selDates ; |
2108 | } | 2156 | } |
2109 | setCaption( i18n("Dates: ") + selDates ); | 2157 | setCaption( i18n("Dates: ") + selDates ); |
2110 | 2158 | ||
2111 | } | 2159 | } |
2112 | void MainWindow::showConfigureAgenda( ) | 2160 | void MainWindow::showConfigureAgenda( ) |
2113 | { | 2161 | { |
2114 | int iii; | 2162 | int iii; |
2115 | for ( iii = 1;iii<= 10 ;++iii ){ | 2163 | for ( iii = 1;iii<= 10 ;++iii ){ |
2116 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2164 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2117 | } | 2165 | } |
2118 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2166 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2119 | } | 2167 | } |
2120 | void MainWindow::configureAgenda( int item ) | 2168 | void MainWindow::configureAgenda( int item ) |
2121 | { | 2169 | { |
2122 | if ( KOPrefs::instance()->mHourSize == item ) | 2170 | if ( KOPrefs::instance()->mHourSize == item ) |
2123 | return; | 2171 | return; |
2124 | KOPrefs::instance()->mHourSize=item; | 2172 | KOPrefs::instance()->mHourSize=item; |
2125 | mView->viewManager()->agendaView()->updateConfig(); | 2173 | mView->viewManager()->agendaView()->updateConfig(); |
2126 | } | 2174 | } |
2127 | 2175 | ||
2128 | void MainWindow::saveCalendar() | 2176 | void MainWindow::saveCalendar() |
2129 | { | 2177 | { |
2130 | QString fn = KOPrefs::instance()->mLastSaveFile; | 2178 | QString fn = KOPrefs::instance()->mLastSaveFile; |
2131 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 2179 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
2132 | 2180 | ||
2133 | if ( fn == "" ) | 2181 | if ( fn == "" ) |
2134 | return; | 2182 | return; |
2135 | QFileInfo info; | 2183 | QFileInfo info; |
2136 | info.setFile( fn ); | 2184 | info.setFile( fn ); |
2137 | QString mes; | 2185 | QString mes; |
2138 | bool createbup = true; | 2186 | bool createbup = true; |
2139 | if ( info. exists() ) { | 2187 | if ( info. exists() ) { |
2140 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2188 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
2141 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2189 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2142 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2190 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2143 | 0, 1 ); | 2191 | 0, 1 ); |
2144 | if ( result != 0 ) { | 2192 | if ( result != 0 ) { |
2145 | createbup = false; | 2193 | createbup = false; |
2146 | } | 2194 | } |
2147 | } | 2195 | } |
2148 | if ( createbup ) { | 2196 | if ( createbup ) { |
2149 | mView->saveCalendar( fn ); | 2197 | mView->saveCalendar( fn ); |
2150 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 2198 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
2151 | KOPrefs::instance()->mLastSaveFile = fn; | 2199 | KOPrefs::instance()->mLastSaveFile = fn; |
2152 | setCaption(mes); | 2200 | setCaption(mes); |
2153 | } | 2201 | } |
2154 | } | 2202 | } |
2155 | void MainWindow::loadCalendar() | 2203 | void MainWindow::loadCalendar() |
2156 | { | 2204 | { |
2157 | 2205 | ||
2158 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2206 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2159 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2207 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2160 | 2208 | ||
2161 | if ( fn == "" ) | 2209 | if ( fn == "" ) |
2162 | return; | 2210 | return; |
2163 | QFileInfo info; | 2211 | QFileInfo info; |
2164 | info.setFile( fn ); | 2212 | info.setFile( fn ); |
2165 | QString mess; | 2213 | QString mess; |
2166 | bool loadbup = true; | 2214 | bool loadbup = true; |
2167 | if ( info. exists() ) { | 2215 | if ( info. exists() ) { |
2168 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2216 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2169 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2217 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2170 | mess, | 2218 | mess, |
2171 | i18n("Load!"), i18n("Cancel"), 0, | 2219 | i18n("Load!"), i18n("Cancel"), 0, |
2172 | 0, 1 ); | 2220 | 0, 1 ); |
2173 | if ( result != 0 ) { | 2221 | if ( result != 0 ) { |
2174 | loadbup = false; | 2222 | loadbup = false; |
2175 | } | 2223 | } |
2176 | } else { | 2224 | } else { |
2177 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2225 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2178 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2226 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2179 | 0, 1 ); | 2227 | 0, 1 ); |
2180 | 2228 | ||
2181 | return; | 2229 | return; |
2182 | } | 2230 | } |
2183 | if ( loadbup ) { | 2231 | if ( loadbup ) { |
2184 | mView->openCalendar( fn ); | 2232 | mView->openCalendar( fn ); |
2185 | KOPrefs::instance()->mLastLoadFile = fn; | 2233 | KOPrefs::instance()->mLastLoadFile = fn; |
2186 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2234 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2187 | setCaption(mess); | 2235 | setCaption(mess); |
2188 | } | 2236 | } |
2189 | 2237 | ||
2190 | } | 2238 | } |
2191 | void MainWindow::quickImportIcal() | 2239 | void MainWindow::quickImportIcal() |
2192 | { | 2240 | { |
2193 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2241 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2194 | } | 2242 | } |
2195 | void MainWindow::importFile( QString fn, bool quick ) | 2243 | void MainWindow::importFile( QString fn, bool quick ) |
2196 | { | 2244 | { |
2197 | QFileInfo info; | 2245 | QFileInfo info; |
2198 | info.setFile( fn ); | 2246 | info.setFile( fn ); |
2199 | QString mess; | 2247 | QString mess; |
2200 | bool loadbup = true; | 2248 | bool loadbup = true; |
2201 | if ( !info. exists() ) { | 2249 | if ( !info. exists() ) { |
2202 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2250 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2203 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2251 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2204 | mess ); | 2252 | mess ); |
2205 | return; | 2253 | return; |
2206 | } | 2254 | } |
2207 | int result = 0; | 2255 | int result = 0; |
2208 | if ( !quick ) { | 2256 | if ( !quick ) { |
2209 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2257 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2210 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2258 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2211 | mess, | 2259 | mess, |
2212 | "Import", "Cancel", 0, | 2260 | "Import", "Cancel", 0, |
2213 | 0, 1 ); | 2261 | 0, 1 ); |
2214 | } | 2262 | } |
2215 | if ( result == 0 ) { | 2263 | if ( result == 0 ) { |
2216 | if ( mView->openCalendar( fn, true )) { | 2264 | if ( mView->openCalendar( fn, true )) { |
2217 | KOPrefs::instance()->mLastImportFile = fn; | 2265 | KOPrefs::instance()->mLastImportFile = fn; |
2218 | setCaption(i18n("Imported file successfully")); | 2266 | setCaption(i18n("Imported file successfully")); |
2219 | } else { | 2267 | } else { |
2220 | setCaption(i18n("Error importing file")); | 2268 | setCaption(i18n("Error importing file")); |
2221 | } | 2269 | } |
2222 | } | 2270 | } |
2223 | } | 2271 | } |
2224 | 2272 | ||
2225 | void MainWindow::importIcal() | 2273 | void MainWindow::importIcal() |
2226 | { | 2274 | { |
2227 | 2275 | ||
2228 | QString fn =KOPrefs::instance()->mLastImportFile; | 2276 | QString fn =KOPrefs::instance()->mLastImportFile; |
2229 | 2277 | ||
2230 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2278 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2231 | if ( fn == "" ) | 2279 | if ( fn == "" ) |
2232 | return; | 2280 | return; |
2233 | importFile( fn, true ); | 2281 | importFile( fn, true ); |
2234 | 2282 | ||
2235 | } | 2283 | } |
2236 | 2284 | ||
2237 | void MainWindow::exportVCalendar() | 2285 | void MainWindow::exportVCalendar() |
2238 | { | 2286 | { |
2239 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2287 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2240 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2288 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2241 | if ( fn == "" ) | 2289 | if ( fn == "" ) |
2242 | return; | 2290 | return; |
2243 | QFileInfo info; | 2291 | QFileInfo info; |
2244 | info.setFile( fn ); | 2292 | info.setFile( fn ); |
2245 | QString mes; | 2293 | QString mes; |
2246 | bool createbup = true; | 2294 | bool createbup = true; |
2247 | if ( info. exists() ) { | 2295 | if ( info. exists() ) { |
2248 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2296 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2249 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2297 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2250 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2298 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2251 | 0, 1 ); | 2299 | 0, 1 ); |
2252 | if ( result != 0 ) { | 2300 | if ( result != 0 ) { |
2253 | createbup = false; | 2301 | createbup = false; |
2254 | } | 2302 | } |
2255 | } | 2303 | } |
2256 | if ( createbup ) { | 2304 | if ( createbup ) { |
2257 | if ( mView->exportVCalendar( fn ) ) { | 2305 | if ( mView->exportVCalendar( fn ) ) { |
2258 | KOPrefs::instance()->mLastVcalFile = fn; | 2306 | KOPrefs::instance()->mLastVcalFile = fn; |
2259 | if ( fn.length() > 20 ) | 2307 | if ( fn.length() > 20 ) |
2260 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2308 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2261 | else | 2309 | else |
2262 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2310 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2263 | setCaption(mes); | 2311 | setCaption(mes); |
2264 | } | 2312 | } |
2265 | } | 2313 | } |
2266 | 2314 | ||
2267 | } | 2315 | } |
2268 | QString MainWindow::sentSyncFile() | 2316 | QString MainWindow::sentSyncFile() |
2269 | { | 2317 | { |
2270 | #ifdef DESKTOP_VERSION | 2318 | #ifdef DESKTOP_VERSION |
2271 | return locateLocal( "tmp", "copysynccal.ics" ); | 2319 | return locateLocal( "tmp", "copysynccal.ics" ); |
2272 | #else | 2320 | #else |
2273 | return QString( "/tmp/copysynccal.ics" ); | 2321 | return QString( "/tmp/copysynccal.ics" ); |
2274 | #endif | 2322 | #endif |
2275 | } | 2323 | } |
2276 | 2324 | ||
2277 | void MainWindow::syncFileRequest() | 2325 | void MainWindow::syncFileRequest() |
2278 | { | 2326 | { |
2279 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2327 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2280 | mSyncManager->slotSyncMenu( 999 ); | 2328 | mSyncManager->slotSyncMenu( 999 ); |
2281 | } | 2329 | } |
2282 | 2330 | ||
2283 | setCaption(i18n("Saving Data to temp file ..." )); | 2331 | setCaption(i18n("Saving Data to temp file ..." )); |
2284 | mView->saveCalendar( sentSyncFile() ); | 2332 | mView->saveCalendar( sentSyncFile() ); |
2285 | setCaption(i18n("Data saved to temp file!" )); | 2333 | setCaption(i18n("Data saved to temp file!" )); |
2286 | 2334 | ||
2287 | } | 2335 | } |
2288 | void MainWindow::getFile( bool success ) | 2336 | void MainWindow::getFile( bool success ) |
2289 | { | 2337 | { |
2290 | if ( ! success ) { | 2338 | if ( ! success ) { |
2291 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2339 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2292 | return; | 2340 | return; |
2293 | } | 2341 | } |
2294 | mView->openCalendar( sentSyncFile() ); | 2342 | mView->openCalendar( sentSyncFile() ); |
2295 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2343 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2296 | mSyncManager->slotSyncMenu( 999 ); | 2344 | mSyncManager->slotSyncMenu( 999 ); |
2297 | } | 2345 | } |
2298 | setCaption( i18n("Pi-Sync successful!") ); | 2346 | setCaption( i18n("Pi-Sync successful!") ); |
2299 | } | 2347 | } |
2300 | 2348 | ||
2301 | void MainWindow::printSel( ) | 2349 | void MainWindow::printSel( ) |
2302 | { | 2350 | { |
2303 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2351 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2304 | } | 2352 | } |
2305 | 2353 | ||
2306 | void MainWindow::printCal() | 2354 | void MainWindow::printCal() |
2307 | { | 2355 | { |
2308 | mView->print();//mCp->showDialog(); | 2356 | mView->print();//mCp->showDialog(); |
2309 | } | 2357 | } |
2310 | 2358 | ||
2311 | 2359 | ||
2312 | #include "libkdepim/kdatepicker.h" | 2360 | #include "libkdepim/kdatepicker.h" |
2313 | #include <kdatetbl.h> | 2361 | #include <kdatetbl.h> |
2362 | |||
2314 | void MainWindow::weekAction() | 2363 | void MainWindow::weekAction() |
2315 | { | 2364 | { |
2316 | int month; | 2365 | int month; |
2317 | KPopupFrame* popup = new KPopupFrame(this); | 2366 | KPopupFrame* popup = new KPopupFrame(this); |
2318 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2367 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2319 | // ----- | 2368 | // ----- |
2320 | picker->resize(picker->sizeHint()); | 2369 | picker->resize(picker->sizeHint()); |
2321 | popup->setMainWidget(picker); | 2370 | popup->setMainWidget(picker); |
2322 | picker->setFocus(); | 2371 | picker->setFocus(); |
2323 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2372 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2324 | int x = 0; | 2373 | int x = 0; |
2325 | int y = iconToolBar->height(); | 2374 | int y = iconToolBar->height(); |
2326 | int dX = 0; | 2375 | int dX = 0; |
2327 | int dY = 0; | 2376 | int dY = 0; |
2328 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2377 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2329 | if ( iconToolBar->y() > height()/2 ) { | 2378 | if ( iconToolBar->y() > height()/2 ) { |
2330 | dY = picker->sizeHint().height()+8; | 2379 | dY = picker->sizeHint().height()+8; |
2331 | y = 0; | 2380 | y = 0; |
2332 | } | 2381 | } |
2333 | } else { | 2382 | } else { |
2334 | if ( iconToolBar->x() > width()/2 ) { // right side | 2383 | if ( iconToolBar->x() > width()/2 ) { // right side |
2335 | x=0; | 2384 | x=0; |
2336 | dX= picker->sizeHint().width()+8; | 2385 | dX= picker->sizeHint().width()+8; |
2337 | y = 0; | 2386 | y = 0; |
2338 | } else { | 2387 | } else { |
2339 | x= iconToolBar->width(); | 2388 | x= iconToolBar->width(); |
2340 | y = 0; | 2389 | y = 0; |
2341 | } | 2390 | } |
2342 | } | 2391 | } |
2343 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2392 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2344 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2393 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2345 | { | 2394 | { |
2346 | month = picker->getResult(); | 2395 | month = picker->getResult(); |
2347 | emit selectWeek ( month ); | 2396 | emit selectWeek ( month ); |
2348 | //qDebug("weekSelected %d ", month); | 2397 | //qDebug("weekSelected %d ", month); |
2349 | } | 2398 | } |
2350 | delete popup; | 2399 | delete popup; |
2351 | } | 2400 | } |
2352 | 2401 | ||
2353 | void MainWindow::hideEvent ( QHideEvent * ) | 2402 | void MainWindow::hideEvent ( QHideEvent * ) |
2354 | { | 2403 | { |
2355 | QString message; | 2404 | QString message; |
2356 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2405 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2357 | if ( nextA.isValid() ) { | 2406 | if ( nextA.isValid() ) { |
2358 | QString sum = mCalendar->nextSummary(); | 2407 | QString sum = mCalendar->nextSummary(); |
2359 | 2408 | ||
2360 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2409 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2361 | setCaption( message ); | 2410 | setCaption( message ); |
2362 | } | 2411 | } |
2363 | } | 2412 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 79fb305..7c16aeb 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,170 +1,172 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
27 | class QPEMenuBar; | 27 | class QPEMenuBar; |
28 | 28 | ||
29 | 29 | ||
30 | namespace KCal { | 30 | namespace KCal { |
31 | class CalendarLocal; | 31 | class CalendarLocal; |
32 | } | 32 | } |
33 | 33 | ||
34 | class KOMenuBar : public QMenuBar | 34 | class KOMenuBar : public QMenuBar |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 37 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
38 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 38 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
39 | }; | 39 | }; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | class MainWindow : public QMainWindow | 43 | class MainWindow : public QMainWindow |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 47 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
48 | ~MainWindow(); | 48 | ~MainWindow(); |
49 | bool beamReceiveEnabled(); | 49 | bool beamReceiveEnabled(); |
50 | static QString defaultFileName(); | 50 | static QString defaultFileName(); |
51 | static QString syncFileName(); | 51 | static QString syncFileName(); |
52 | static QString resourcePath(); | 52 | static QString resourcePath(); |
53 | public slots: | 53 | public slots: |
54 | void setCaption ( const QString & ); | 54 | void setCaption ( const QString & ); |
55 | void updateWeekNum(const KCal::DateList &); | 55 | void updateWeekNum(const KCal::DateList &); |
56 | void updateWeek(QDate); | 56 | void updateWeek(QDate); |
57 | void updateFilterToolbar(); | 57 | void updateFilterToolbar(); |
58 | virtual void showMaximized (); | 58 | virtual void showMaximized (); |
59 | void configureAgenda( int ); | 59 | void configureAgenda( int ); |
60 | void recieve( const QCString& msg, const QByteArray& data ); | 60 | void recieve( const QCString& msg, const QByteArray& data ); |
61 | protected slots: | 61 | protected slots: |
62 | void setCaptionToDates(); | 62 | void setCaptionToDates(); |
63 | void weekAction(); | 63 | void weekAction(); |
64 | void about(); | 64 | void about(); |
65 | void licence(); | 65 | void licence(); |
66 | void faq(); | 66 | void faq(); |
67 | void usertrans(); | 67 | void usertrans(); |
68 | void features(); | 68 | void features(); |
69 | void synchowto(); | 69 | void synchowto(); |
70 | void kdesynchowto(); | 70 | void kdesynchowto(); |
71 | void multisynchowto(); | 71 | void multisynchowto(); |
72 | void whatsNew(); | 72 | void whatsNew(); |
73 | void keyBindings(); | 73 | void keyBindings(); |
74 | void aboutAutoSaving();; | 74 | void aboutAutoSaving();; |
75 | void aboutKnownBugs(); | 75 | void aboutKnownBugs(); |
76 | 76 | ||
77 | void processIncidenceSelection( Incidence * ); | 77 | void processIncidenceSelection( Incidence * ); |
78 | 78 | ||
79 | void importQtopia(); | 79 | void importQtopia(); |
80 | void importBday(); | 80 | void importBday(); |
81 | void importOL(); | 81 | void importOL(); |
82 | void importIcal(); | 82 | void importIcal(); |
83 | void importFile( QString, bool ); | 83 | void importFile( QString, bool ); |
84 | void quickImportIcal(); | 84 | void quickImportIcal(); |
85 | 85 | ||
86 | void slotModifiedChanged( bool ); | 86 | void slotModifiedChanged( bool ); |
87 | 87 | ||
88 | void save(); | 88 | void save(); |
89 | void saveStopTimer(); | 89 | void saveStopTimer(); |
90 | void configureToolBar( int ); | 90 | void configureToolBar( int ); |
91 | void printSel(); | 91 | void printSel(); |
92 | void printCal(); | 92 | void printCal(); |
93 | void saveCalendar(); | 93 | void saveCalendar(); |
94 | void loadCalendar(); | 94 | void loadCalendar(); |
95 | void exportVCalendar(); | 95 | void exportVCalendar(); |
96 | void fillFilterMenu(); | 96 | void fillFilterMenu(); |
97 | void fillFilterMenuTB(); | ||
97 | void selectFilter( int ); | 98 | void selectFilter( int ); |
98 | void fillFilterMenuPopup(); | 99 | void fillFilterMenuPopup(); |
99 | void selectFilterPopup( int ); | 100 | void selectFilterPopup( int ); |
100 | void exportToPhone( int ); | 101 | void exportToPhone( int ); |
101 | void toggleBeamReceive(); | 102 | void toggleBeamReceive(); |
102 | void disableBR(bool); | 103 | void disableBR(bool); |
103 | signals: | 104 | signals: |
104 | void selectWeek ( int ); | 105 | void selectWeek ( int ); |
105 | private slots: | 106 | private slots: |
106 | void showConfigureAgenda(); | 107 | void showConfigureAgenda(); |
107 | void getFile( bool ); | 108 | void getFile( bool ); |
108 | void syncFileRequest(); | 109 | void syncFileRequest(); |
109 | 110 | ||
110 | protected: | 111 | protected: |
111 | void hideEvent ( QHideEvent * ); | 112 | void hideEvent ( QHideEvent * ); |
112 | QString sentSyncFile(); | 113 | QString sentSyncFile(); |
113 | void displayText( QString, QString); | 114 | void displayText( QString, QString); |
114 | void enableIncidenceActions( bool ); | 115 | void enableIncidenceActions( bool ); |
115 | 116 | ||
116 | private: | 117 | private: |
117 | bool mBRdisabled; | 118 | bool mBRdisabled; |
118 | #ifndef DESKTOP_VERSION | 119 | #ifndef DESKTOP_VERSION |
119 | QCopChannel* infrared; | 120 | QCopChannel* infrared; |
120 | #endif | 121 | #endif |
121 | QAction* brAction; | 122 | QAction* brAction; |
122 | KSyncManager* mSyncManager; | 123 | KSyncManager* mSyncManager; |
123 | bool mClosed; | 124 | bool mClosed; |
124 | void saveOnClose(); | 125 | void saveOnClose(); |
125 | bool mFlagKeyPressed; | 126 | bool mFlagKeyPressed; |
126 | bool mBlockAtStartup; | 127 | bool mBlockAtStartup; |
127 | QPEToolBar *iconToolBar; | 128 | QPEToolBar *iconToolBar; |
128 | QPEToolBar *viewToolBar; | 129 | QPEToolBar *viewToolBar; |
129 | QPEToolBar *navigatorToolBar; | 130 | QPEToolBar *navigatorToolBar; |
130 | QPEToolBar *filterToolBar; | 131 | QPEToolBar *filterToolBar; |
131 | QPEMenuBar *filterMenubar; | 132 | QPEMenuBar *filterMenubar; |
132 | QPopupMenu * filterPopupMenu; | 133 | QPopupMenu * filterPopupMenu; |
133 | void initActions(); | 134 | void initActions(); |
134 | void setDefaultPreferences(); | 135 | void setDefaultPreferences(); |
135 | void keyPressEvent ( QKeyEvent * ) ; | 136 | void keyPressEvent ( QKeyEvent * ) ; |
136 | void keyReleaseEvent ( QKeyEvent * ) ; | 137 | void keyReleaseEvent ( QKeyEvent * ) ; |
137 | QPopupMenu *configureToolBarMenu; | 138 | QPopupMenu *configureToolBarMenu; |
138 | QPopupMenu *selectFilterMenu; | 139 | QPopupMenu *selectFilterMenu; |
140 | QPopupMenu *selectFilterMenuTB; | ||
139 | QPopupMenu *configureAgendaMenu, *syncMenu; | 141 | QPopupMenu *configureAgendaMenu, *syncMenu; |
140 | CalendarLocal *mCalendar; | 142 | CalendarLocal *mCalendar; |
141 | CalendarView *mView; | 143 | CalendarView *mView; |
142 | QAction *mNewSubTodoAction; | 144 | QAction *mNewSubTodoAction; |
143 | QAction *mWeekAction; | 145 | QAction *mWeekAction; |
144 | QFont mWeekFont; | 146 | QFont mWeekFont; |
145 | QPixmap mWeekPixmap; | 147 | QPixmap mWeekPixmap; |
146 | QColor mWeekBgColor; | 148 | QColor mWeekBgColor; |
147 | 149 | ||
148 | QAction *mShowAction; | 150 | QAction *mShowAction; |
149 | QAction *mEditAction; | 151 | QAction *mEditAction; |
150 | QAction *mDeleteAction; | 152 | QAction *mDeleteAction; |
151 | QAction *mCloneAction; | 153 | QAction *mCloneAction; |
152 | QAction *mMoveAction; | 154 | QAction *mMoveAction; |
153 | QAction *mBeamAction; | 155 | QAction *mBeamAction; |
154 | QAction *mCancelAction; | 156 | QAction *mCancelAction; |
155 | 157 | ||
156 | QAction *mToggleNav; | 158 | QAction *mToggleNav; |
157 | QAction *mToggleFilter; | 159 | QAction *mToggleFilter; |
158 | QAction *mToggleAllday; | 160 | QAction *mToggleAllday; |
159 | 161 | QAction *actionFilterMenuTB; | |
160 | 162 | ||
161 | void closeEvent( QCloseEvent* ce ); | 163 | void closeEvent( QCloseEvent* ce ); |
162 | SimpleAlarmClient mAlarmClient; | 164 | SimpleAlarmClient mAlarmClient; |
163 | QTimer mSaveTimer; | 165 | QTimer mSaveTimer; |
164 | //bool mBlockSaveFlag; | 166 | //bool mBlockSaveFlag; |
165 | bool mCalendarModifiedFlag; | 167 | bool mCalendarModifiedFlag; |
166 | QPixmap loadPixmap( QString ); | 168 | QPixmap loadPixmap( QString ); |
167 | }; | 169 | }; |
168 | 170 | ||
169 | 171 | ||
170 | #endif | 172 | #endif |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index bbed38d..5cd845e 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,661 +1,668 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qvbox.h> | 39 | #include <qvbox.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qregexp.h> | 41 | #include <qregexp.h> |
42 | 42 | ||
43 | #include <kdialog.h> | 43 | #include <kdialog.h> |
44 | #include <kprefsdialog.h> | 44 | #include <kprefsdialog.h> |
45 | #include <klocale.h> | 45 | #include <klocale.h> |
46 | #include <kdateedit.h> | 46 | #include <kdateedit.h> |
47 | #include <kglobal.h> | 47 | #include <kglobal.h> |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> |
49 | 49 | ||
50 | /*US | 50 | /*US |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qframe.h> | 52 | #include <qframe.h> |
53 | #include <qpushbutton.h> | 53 | #include <qpushbutton.h> |
54 | #include <qcombobox.h> | 54 | #include <qcombobox.h> |
55 | #include <qlineedit.h> | 55 | #include <qlineedit.h> |
56 | #include <qlabel.h> | 56 | #include <qlabel.h> |
57 | #include <qfile.h> | 57 | #include <qfile.h> |
58 | 58 | ||
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | #include <kdebug.h> | 60 | #include <kdebug.h> |
61 | #include <kdialog.h> | 61 | #include <kdialog.h> |
62 | #include <klistview.h> | 62 | #include <klistview.h> |
63 | #include <klocale.h> | 63 | #include <klocale.h> |
64 | #include <kglobal.h> | 64 | #include <kglobal.h> |
65 | #include <kmessagebox.h> | 65 | #include <kmessagebox.h> |
66 | #include <kstandarddirs.h> | 66 | #include <kstandarddirs.h> |
67 | 67 | ||
68 | #ifndef KAB_EMBEDDED | 68 | #ifndef KAB_EMBEDDED |
69 | #include <ktrader.h> | 69 | #include <ktrader.h> |
70 | #else // KAB_EMBEDDED | 70 | #else // KAB_EMBEDDED |
71 | #include <mergewidget.h> | 71 | #include <mergewidget.h> |
72 | #include <distributionlistwidget.h> | 72 | #include <distributionlistwidget.h> |
73 | #endif // KAB_EMBEDDED | 73 | #endif // KAB_EMBEDDED |
74 | 74 | ||
75 | #include "addresseewidget.h" | 75 | #include "addresseewidget.h" |
76 | #include "extensionconfigdialog.h" | 76 | #include "extensionconfigdialog.h" |
77 | #include "extensionwidget.h" | 77 | #include "extensionwidget.h" |
78 | */ | 78 | */ |
79 | 79 | ||
80 | #include "qapplication.h" | 80 | #include "qapplication.h" |
81 | 81 | ||
82 | #include "kpimglobalprefs.h" | 82 | #include "kpimglobalprefs.h" |
83 | 83 | ||
84 | #include "kdepimconfigwidget.h" | 84 | #include "kdepimconfigwidget.h" |
85 | #include <kprefs.h> | 85 | #include <kprefs.h> |
86 | 86 | ||
87 | 87 | ||
88 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 88 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
89 | : KPrefsWidget(prefs, parent, name ) | 89 | : KPrefsWidget(prefs, parent, name ) |
90 | { | 90 | { |
91 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 91 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
92 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 92 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
93 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 93 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
94 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 94 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
95 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 95 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
96 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
97 | 97 | ||
98 | 98 | ||
99 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 99 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
100 | KDialog::spacingHint() ); | 100 | KDialog::spacingHint() ); |
101 | 101 | ||
102 | tabWidget = new QTabWidget( this ); | 102 | tabWidget = new QTabWidget( this ); |
103 | topLayout->addWidget( tabWidget ); | 103 | topLayout->addWidget( tabWidget ); |
104 | 104 | ||
105 | 105 | ||
106 | setupLocaleTab(); | 106 | setupLocaleTab(); |
107 | setupLocaleDateTab(); | 107 | setupLocaleDateTab(); |
108 | setupTimeZoneTab(); | 108 | setupTimeZoneTab(); |
109 | setupExternalAppTab(); | 109 | setupExternalAppTab(); |
110 | setupStoreTab(); | 110 | setupStoreTab(); |
111 | 111 | ||
112 | } | 112 | } |
113 | void KDEPIMConfigWidget::showTimeZoneTab() | 113 | void KDEPIMConfigWidget::showTimeZoneTab() |
114 | { | 114 | { |
115 | tabWidget->setCurrentPage ( 3 ) ; | 115 | tabWidget->setCurrentPage ( 3 ) ; |
116 | } | 116 | } |
117 | void KDEPIMConfigWidget::setupStoreTab() | 117 | void KDEPIMConfigWidget::setupStoreTab() |
118 | { | 118 | { |
119 | QVBox *storePage = new QVBox( this ); | 119 | QVBox *storePage = new QVBox( this ); |
120 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 120 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); |
121 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 121 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
122 | mStoreUrl = new KURLRequester( storePage ); | 122 | mStoreUrl = new KURLRequester( storePage ); |
123 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 123 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
124 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 124 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
125 | QHBox *bb = new QHBox( storePage ); | 125 | QHBox *bb = new QHBox( storePage ); |
126 | QPushButton * pb; | 126 | QPushButton * pb; |
127 | if ( QApplication::desktop()->width() < 640 ) | 127 | if ( QApplication::desktop()->width() < 640 ) |
128 | pb = new QPushButton ( i18n("Save"), bb ); | 128 | pb = new QPushButton ( i18n("Save"), bb ); |
129 | else | 129 | else |
130 | pb = new QPushButton ( i18n("Save settings"), bb ); | 130 | pb = new QPushButton ( i18n("Save settings"), bb ); |
131 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 131 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
132 | pb = new QPushButton ( i18n("Save standard"), bb ); | 132 | pb = new QPushButton ( i18n("Save standard"), bb ); |
133 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 133 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
134 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 134 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
135 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 135 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
136 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 136 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
137 | } | 137 | } |
138 | void KDEPIMConfigWidget::setStandardStore() | 138 | void KDEPIMConfigWidget::setStandardStore() |
139 | { | 139 | { |
140 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 140 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
141 | saveStoreSettings(); | 141 | saveStoreSettings(); |
142 | } | 142 | } |
143 | void KDEPIMConfigWidget::saveStoreSettings() | 143 | void KDEPIMConfigWidget::saveStoreSettings() |
144 | { | 144 | { |
145 | if ( !mStoreUrl->url().isEmpty() ) { | 145 | if ( !mStoreUrl->url().isEmpty() ) { |
146 | KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" ); | 146 | QString path = QDir::homeDirPath(); |
147 | QString url = mStoreUrl->url(); | ||
148 | #ifdef DESKTOP_VERSION | ||
149 | if ( url.startsWith( "LOCAL:" ) ) { | ||
150 | path = qApp->applicationDirPath () ; | ||
151 | } | ||
152 | #endif | ||
153 | KConfig cfg ( path + "/.microkdehome" ); | ||
147 | cfg.setGroup("Global"); | 154 | cfg.setGroup("Global"); |
148 | cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() ); | 155 | cfg.writeEntry( "MICROKDEHOME", url ); |
149 | qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); "); | 156 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
150 | cfg.sync(); | 157 | cfg.sync(); |
151 | } else { | 158 | } else { |
152 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 159 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
153 | saveStoreSettings(); | 160 | saveStoreSettings(); |
154 | } | 161 | } |
155 | } | 162 | } |
156 | void KDEPIMConfigWidget::setupExternalAppTab() | 163 | void KDEPIMConfigWidget::setupExternalAppTab() |
157 | { | 164 | { |
158 | QWidget *externalAppsPage = new QWidget( this ); | 165 | QWidget *externalAppsPage = new QWidget( this ); |
159 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 166 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
160 | KDialog::spacingHintSmall() ); | 167 | KDialog::spacingHintSmall() ); |
161 | 168 | ||
162 | mExternalApps = new QComboBox( externalAppsPage ); | 169 | mExternalApps = new QComboBox( externalAppsPage ); |
163 | 170 | ||
164 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 171 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
165 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 172 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
166 | mExternalApps->insertItem( it.data(), it.key() ); | 173 | mExternalApps->insertItem( it.data(), it.key() ); |
167 | 174 | ||
168 | layout->addWidget( mExternalApps ); | 175 | layout->addWidget( mExternalApps ); |
169 | 176 | ||
170 | connect( mExternalApps, SIGNAL( activated( int ) ), | 177 | connect( mExternalApps, SIGNAL( activated( int ) ), |
171 | this, SLOT (externalapp_changed( int ) ) ); | 178 | this, SLOT (externalapp_changed( int ) ) ); |
172 | 179 | ||
173 | 180 | ||
174 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 181 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
175 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 182 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
176 | mExternalAppGroupBox->layout()->setMargin(5); | 183 | mExternalAppGroupBox->layout()->setMargin(5); |
177 | 184 | ||
178 | mClient = new QComboBox( mExternalAppGroupBox ); | 185 | mClient = new QComboBox( mExternalAppGroupBox ); |
179 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 186 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
180 | 187 | ||
181 | connect( mClient, SIGNAL( activated( int ) ), | 188 | connect( mClient, SIGNAL( activated( int ) ), |
182 | this, SLOT (client_changed( int ) ) ); | 189 | this, SLOT (client_changed( int ) ) ); |
183 | 190 | ||
184 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 191 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
185 | boxLayout->addWidget( lab, 1, 0 ); | 192 | boxLayout->addWidget( lab, 1, 0 ); |
186 | mChannel = new QLineEdit(mExternalAppGroupBox); | 193 | mChannel = new QLineEdit(mExternalAppGroupBox); |
187 | mChannel->setReadOnly(true); | 194 | mChannel->setReadOnly(true); |
188 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 195 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
189 | 196 | ||
190 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 197 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
191 | boxLayout->addWidget( lab, 3, 0 ); | 198 | boxLayout->addWidget( lab, 3, 0 ); |
192 | mMessage = new QLineEdit(mExternalAppGroupBox); | 199 | mMessage = new QLineEdit(mExternalAppGroupBox); |
193 | mMessage->setReadOnly(true); | 200 | mMessage->setReadOnly(true); |
194 | boxLayout->addWidget( mMessage , 4, 0); | 201 | boxLayout->addWidget( mMessage , 4, 0); |
195 | 202 | ||
196 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 203 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
197 | boxLayout->addWidget( lab, 3, 1 ); | 204 | boxLayout->addWidget( lab, 3, 1 ); |
198 | mParameters = new QLineEdit(mExternalAppGroupBox); | 205 | mParameters = new QLineEdit(mExternalAppGroupBox); |
199 | mParameters->setReadOnly(true); | 206 | mParameters->setReadOnly(true); |
200 | boxLayout->addWidget( mParameters, 4, 1 ); | 207 | boxLayout->addWidget( mParameters, 4, 1 ); |
201 | 208 | ||
202 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 209 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
203 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 210 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
204 | 211 | ||
205 | 212 | ||
206 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 213 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
207 | boxLayout->addWidget( lab, 6, 0 ); | 214 | boxLayout->addWidget( lab, 6, 0 ); |
208 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 215 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
209 | mMessage2->setReadOnly(true); | 216 | mMessage2->setReadOnly(true); |
210 | boxLayout->addWidget( mMessage2 , 7, 0); | 217 | boxLayout->addWidget( mMessage2 , 7, 0); |
211 | 218 | ||
212 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 219 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
213 | boxLayout->addWidget( lab, 6, 1 ); | 220 | boxLayout->addWidget( lab, 6, 1 ); |
214 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 221 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
215 | mParameters2->setReadOnly(true); | 222 | mParameters2->setReadOnly(true); |
216 | boxLayout->addWidget( mParameters2, 7, 1 ); | 223 | boxLayout->addWidget( mParameters2, 7, 1 ); |
217 | 224 | ||
218 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 225 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
219 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 226 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
220 | 227 | ||
221 | 228 | ||
222 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 229 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
223 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 230 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
224 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 231 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
225 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 232 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
226 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 233 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
227 | 234 | ||
228 | 235 | ||
229 | layout->addWidget( mExternalAppGroupBox ); | 236 | layout->addWidget( mExternalAppGroupBox ); |
230 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 237 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
231 | 238 | ||
232 | } | 239 | } |
233 | 240 | ||
234 | 241 | ||
235 | void KDEPIMConfigWidget::setupLocaleDateTab() | 242 | void KDEPIMConfigWidget::setupLocaleDateTab() |
236 | { | 243 | { |
237 | QWidget *topFrame = new QWidget( this ); | 244 | QWidget *topFrame = new QWidget( this ); |
238 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 245 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
239 | 246 | ||
240 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 247 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
241 | topLayout->setMargin(KDialog::marginHintSmall()); | 248 | topLayout->setMargin(KDialog::marginHintSmall()); |
242 | int iii = 0; | 249 | int iii = 0; |
243 | 250 | ||
244 | 251 | ||
245 | KPrefsWidRadios *syncPrefsGroup = | 252 | KPrefsWidRadios *syncPrefsGroup = |
246 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 253 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
247 | QString format; | 254 | QString format; |
248 | if ( QApplication::desktop()->width() < 480 ) | 255 | if ( QApplication::desktop()->width() < 480 ) |
249 | format = "(%d.%m.%Y)"; | 256 | format = "(%d.%m.%Y)"; |
250 | else | 257 | else |
251 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 258 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
252 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 259 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
253 | if ( QApplication::desktop()->width() < 480 ) | 260 | if ( QApplication::desktop()->width() < 480 ) |
254 | format = "(%m.%d.%Y)"; | 261 | format = "(%m.%d.%Y)"; |
255 | else | 262 | else |
256 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 263 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
257 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 264 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
258 | if ( QApplication::desktop()->width() < 480 ) | 265 | if ( QApplication::desktop()->width() < 480 ) |
259 | format = "(%Y-%m-%d)"; | 266 | format = "(%Y-%m-%d)"; |
260 | else | 267 | else |
261 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 268 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
262 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 269 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
263 | syncPrefsGroup->addRadio(i18n("User defined")); | 270 | syncPrefsGroup->addRadio(i18n("User defined")); |
264 | if ( QApplication::desktop()->width() < 480 ) { | 271 | if ( QApplication::desktop()->width() < 480 ) { |
265 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 272 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
266 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 273 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
267 | } | 274 | } |
268 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 275 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
269 | ++iii; | 276 | ++iii; |
270 | ++iii; | 277 | ++iii; |
271 | QLabel * lab; | 278 | QLabel * lab; |
272 | mUserDateFormatLong = new QLineEdit(topFrame); | 279 | mUserDateFormatLong = new QLineEdit(topFrame); |
273 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 280 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
274 | topLayout->addWidget(lab ,iii,0); | 281 | topLayout->addWidget(lab ,iii,0); |
275 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 282 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
276 | ++iii; | 283 | ++iii; |
277 | mUserDateFormatShort = new QLineEdit(topFrame); | 284 | mUserDateFormatShort = new QLineEdit(topFrame); |
278 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 285 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
279 | topLayout->addWidget(lab ,iii,0); | 286 | topLayout->addWidget(lab ,iii,0); |
280 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 287 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
281 | ++iii; | 288 | ++iii; |
282 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 289 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
283 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 290 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
284 | ++iii; | 291 | ++iii; |
285 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 292 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
286 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 293 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
287 | ++iii; | 294 | ++iii; |
288 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 295 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
289 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 296 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
290 | ++iii; | 297 | ++iii; |
291 | 298 | ||
292 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 299 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
293 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 300 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
294 | 301 | ||
295 | 302 | ||
296 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 303 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
297 | } | 304 | } |
298 | 305 | ||
299 | void KDEPIMConfigWidget::setupLocaleTab() | 306 | void KDEPIMConfigWidget::setupLocaleTab() |
300 | { | 307 | { |
301 | 308 | ||
302 | QWidget *topFrame = new QWidget( this ); | 309 | QWidget *topFrame = new QWidget( this ); |
303 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 310 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
304 | 311 | ||
305 | topLayout->setSpacing(KDialog::spacingHint()); | 312 | topLayout->setSpacing(KDialog::spacingHint()); |
306 | topLayout->setMargin(KDialog::marginHint()); | 313 | topLayout->setMargin(KDialog::marginHint()); |
307 | int iii = 0; | 314 | int iii = 0; |
308 | KPrefsWidRadios *syncPrefsGroup = | 315 | KPrefsWidRadios *syncPrefsGroup = |
309 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 316 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
310 | syncPrefsGroup->addRadio(i18n("English")); | 317 | syncPrefsGroup->addRadio(i18n("English")); |
311 | syncPrefsGroup->addRadio(i18n("German")); | 318 | syncPrefsGroup->addRadio(i18n("German")); |
312 | syncPrefsGroup->addRadio(i18n("French")); | 319 | syncPrefsGroup->addRadio(i18n("French")); |
313 | syncPrefsGroup->addRadio(i18n("Italian")); | 320 | syncPrefsGroup->addRadio(i18n("Italian")); |
314 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 321 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
315 | if ( QApplication::desktop()->width() < 300 ) { | 322 | if ( QApplication::desktop()->width() < 300 ) { |
316 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 323 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
317 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 324 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
318 | } | 325 | } |
319 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 326 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
320 | ++iii; | 327 | ++iii; |
321 | 328 | ||
322 | 329 | ||
323 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 330 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
324 | topFrame = new QWidget( this ); | 331 | topFrame = new QWidget( this ); |
325 | topLayout = new QGridLayout(topFrame,4,2); | 332 | topLayout = new QGridLayout(topFrame,4,2); |
326 | 333 | ||
327 | topLayout->setSpacing(KDialog::spacingHint()); | 334 | topLayout->setSpacing(KDialog::spacingHint()); |
328 | topLayout->setMargin(KDialog::marginHint()); | 335 | topLayout->setMargin(KDialog::marginHint()); |
329 | iii = 0; | 336 | iii = 0; |
330 | syncPrefsGroup = | 337 | syncPrefsGroup = |
331 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 338 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
332 | if ( QApplication::desktop()->width() > 300 ) | 339 | if ( QApplication::desktop()->width() > 300 ) |
333 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 340 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
334 | syncPrefsGroup->addRadio(i18n("24:00")); | 341 | syncPrefsGroup->addRadio(i18n("24:00")); |
335 | syncPrefsGroup->addRadio(i18n("12:00am")); | 342 | syncPrefsGroup->addRadio(i18n("12:00am")); |
336 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 343 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
337 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 344 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
338 | ++iii; | 345 | ++iii; |
339 | 346 | ||
340 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 347 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
341 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 348 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
342 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 349 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
343 | ++iii; | 350 | ++iii; |
344 | 351 | ||
345 | 352 | ||
346 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 353 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
347 | 354 | ||
348 | } | 355 | } |
349 | 356 | ||
350 | 357 | ||
351 | void KDEPIMConfigWidget::setupTimeZoneTab() | 358 | void KDEPIMConfigWidget::setupTimeZoneTab() |
352 | { | 359 | { |
353 | QWidget *topFrame; | 360 | QWidget *topFrame; |
354 | QGridLayout *topLayout ; | 361 | QGridLayout *topLayout ; |
355 | 362 | ||
356 | 363 | ||
357 | 364 | ||
358 | 365 | ||
359 | 366 | ||
360 | 367 | ||
361 | topFrame = new QWidget( this ); | 368 | topFrame = new QWidget( this ); |
362 | topLayout = new QGridLayout( topFrame, 5, 2); | 369 | topLayout = new QGridLayout( topFrame, 5, 2); |
363 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 370 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
364 | topLayout->setMargin(KDialog::marginHintSmall()); | 371 | topLayout->setMargin(KDialog::marginHintSmall()); |
365 | 372 | ||
366 | QHBox *timeZoneBox = new QHBox( topFrame ); | 373 | QHBox *timeZoneBox = new QHBox( topFrame ); |
367 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 374 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
368 | 375 | ||
369 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 376 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
370 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 377 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
371 | if ( QApplication::desktop()->width() < 300 ) { | 378 | if ( QApplication::desktop()->width() < 300 ) { |
372 | mTimeZoneCombo->setMaximumWidth(150); | 379 | mTimeZoneCombo->setMaximumWidth(150); |
373 | } | 380 | } |
374 | 381 | ||
375 | QStringList list; | 382 | QStringList list; |
376 | list = KGlobal::locale()->timeZoneList(); | 383 | list = KGlobal::locale()->timeZoneList(); |
377 | mTimeZoneCombo->insertStringList(list); | 384 | mTimeZoneCombo->insertStringList(list); |
378 | 385 | ||
379 | // find the currently set time zone and select it | 386 | // find the currently set time zone and select it |
380 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 387 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
381 | int nCurrentlySet = 11; | 388 | int nCurrentlySet = 11; |
382 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 389 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
383 | { | 390 | { |
384 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 391 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
385 | { | 392 | { |
386 | nCurrentlySet = i; | 393 | nCurrentlySet = i; |
387 | break; | 394 | break; |
388 | } | 395 | } |
389 | } | 396 | } |
390 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 397 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
391 | int iii = 1; | 398 | int iii = 1; |
392 | KPrefsWidBool *sb = | 399 | KPrefsWidBool *sb = |
393 | addWidBool(i18n("Add 30 min to selected Timezone"), | 400 | addWidBool(i18n("Add 30 min to selected Timezone"), |
394 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 401 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
395 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 402 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
396 | ++iii; | 403 | ++iii; |
397 | sb = | 404 | sb = |
398 | addWidBool(i18n("Timezone has daylight saving"), | 405 | addWidBool(i18n("Timezone has daylight saving"), |
399 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 406 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
400 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 407 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
401 | ++iii; | 408 | ++iii; |
402 | QLabel* lab; | 409 | QLabel* lab; |
403 | 410 | ||
404 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 411 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
405 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 412 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
406 | ++iii; | 413 | ++iii; |
407 | 414 | ||
408 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 415 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
409 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 416 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
410 | ++iii; | 417 | ++iii; |
411 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 418 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
412 | topLayout->addWidget(lab, iii,0); | 419 | topLayout->addWidget(lab, iii,0); |
413 | mStartDateSavingEdit = new KDateEdit(topFrame); | 420 | mStartDateSavingEdit = new KDateEdit(topFrame); |
414 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 421 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
415 | ++iii; | 422 | ++iii; |
416 | 423 | ||
417 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 424 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
418 | topLayout->addWidget(lab, iii,0); | 425 | topLayout->addWidget(lab, iii,0); |
419 | mEndDateSavingEdit = new KDateEdit(topFrame); | 426 | mEndDateSavingEdit = new KDateEdit(topFrame); |
420 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 427 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
421 | ++iii; | 428 | ++iii; |
422 | QDate current ( 2001, 1,1); | 429 | QDate current ( 2001, 1,1); |
423 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 430 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
424 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 431 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
425 | 432 | ||
426 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 433 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
427 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 434 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
428 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 435 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
429 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 436 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
430 | 437 | ||
431 | 438 | ||
432 | topFrame = new QWidget( this ); | 439 | topFrame = new QWidget( this ); |
433 | topLayout = new QGridLayout( topFrame, 3, 2); | 440 | topLayout = new QGridLayout( topFrame, 3, 2); |
434 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 441 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
435 | topLayout->setMargin(KDialog::marginHintSmall()); | 442 | topLayout->setMargin(KDialog::marginHintSmall()); |
436 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 443 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
437 | 444 | ||
438 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 445 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
439 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 446 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
440 | int i = 1; | 447 | int i = 1; |
441 | KPrefsWidFont *timeLabelsFont = | 448 | KPrefsWidFont *timeLabelsFont = |
442 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 449 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
443 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 450 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
444 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 451 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
445 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 452 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
446 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 453 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
447 | } | 454 | } |
448 | 455 | ||
449 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 456 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
450 | { | 457 | { |
451 | // first store the current data | 458 | // first store the current data |
452 | saveEditFieldSettings(); | 459 | saveEditFieldSettings(); |
453 | 460 | ||
454 | // set mCurrentApp | 461 | // set mCurrentApp |
455 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 462 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
456 | 463 | ||
457 | // set mCurrentClient | 464 | // set mCurrentClient |
458 | switch(mCurrentApp) | 465 | switch(mCurrentApp) |
459 | { | 466 | { |
460 | case(ExternalAppHandler::EMAIL): | 467 | case(ExternalAppHandler::EMAIL): |
461 | mCurrentClient = mEmailClient; | 468 | mCurrentClient = mEmailClient; |
462 | break; | 469 | break; |
463 | case(ExternalAppHandler::PHONE): | 470 | case(ExternalAppHandler::PHONE): |
464 | mCurrentClient = mPhoneClient; | 471 | mCurrentClient = mPhoneClient; |
465 | break; | 472 | break; |
466 | case(ExternalAppHandler::SMS): | 473 | case(ExternalAppHandler::SMS): |
467 | mCurrentClient = mSMSClient; | 474 | mCurrentClient = mSMSClient; |
468 | break; | 475 | break; |
469 | case(ExternalAppHandler::FAX): | 476 | case(ExternalAppHandler::FAX): |
470 | mCurrentClient = mFaxClient; | 477 | mCurrentClient = mFaxClient; |
471 | break; | 478 | break; |
472 | case(ExternalAppHandler::PAGER): | 479 | case(ExternalAppHandler::PAGER): |
473 | mCurrentClient = mPagerClient; | 480 | mCurrentClient = mPagerClient; |
474 | break; | 481 | break; |
475 | case(ExternalAppHandler::SIP): | 482 | case(ExternalAppHandler::SIP): |
476 | mCurrentClient = mSipClient; | 483 | mCurrentClient = mSipClient; |
477 | break; | 484 | break; |
478 | default: | 485 | default: |
479 | return; | 486 | return; |
480 | } | 487 | } |
481 | 488 | ||
482 | // and at last update the widgets | 489 | // and at last update the widgets |
483 | updateClientWidgets(); | 490 | updateClientWidgets(); |
484 | } | 491 | } |
485 | 492 | ||
486 | 493 | ||
487 | 494 | ||
488 | void KDEPIMConfigWidget::client_changed( int newClient ) | 495 | void KDEPIMConfigWidget::client_changed( int newClient ) |
489 | { | 496 | { |
490 | if (newClient == mCurrentClient) | 497 | if (newClient == mCurrentClient) |
491 | return; | 498 | return; |
492 | 499 | ||
493 | // first store the current data | 500 | // first store the current data |
494 | saveEditFieldSettings(); | 501 | saveEditFieldSettings(); |
495 | 502 | ||
496 | 503 | ||
497 | //then reset the clientvariable | 504 | //then reset the clientvariable |
498 | mCurrentClient = newClient; | 505 | mCurrentClient = newClient; |
499 | 506 | ||
500 | // and at last update the widgets | 507 | // and at last update the widgets |
501 | updateClientWidgets(); | 508 | updateClientWidgets(); |
502 | 509 | ||
503 | KPrefsWidget::modified(); | 510 | KPrefsWidget::modified(); |
504 | } | 511 | } |
505 | 512 | ||
506 | void KDEPIMConfigWidget::saveEditFieldSettings() | 513 | void KDEPIMConfigWidget::saveEditFieldSettings() |
507 | { | 514 | { |
508 | 515 | ||
509 | switch(mCurrentApp) | 516 | switch(mCurrentApp) |
510 | { | 517 | { |
511 | case(ExternalAppHandler::EMAIL): | 518 | case(ExternalAppHandler::EMAIL): |
512 | mEmailClient = mClient->currentItem(); | 519 | mEmailClient = mClient->currentItem(); |
513 | break; | 520 | break; |
514 | case(ExternalAppHandler::PHONE): | 521 | case(ExternalAppHandler::PHONE): |
515 | mPhoneClient= mClient->currentItem(); | 522 | mPhoneClient= mClient->currentItem(); |
516 | break; | 523 | break; |
517 | case(ExternalAppHandler::SMS): | 524 | case(ExternalAppHandler::SMS): |
518 | mSMSClient = mClient->currentItem(); | 525 | mSMSClient = mClient->currentItem(); |
519 | break; | 526 | break; |
520 | case(ExternalAppHandler::FAX): | 527 | case(ExternalAppHandler::FAX): |
521 | mFaxClient = mClient->currentItem(); | 528 | mFaxClient = mClient->currentItem(); |
522 | break; | 529 | break; |
523 | case(ExternalAppHandler::PAGER): | 530 | case(ExternalAppHandler::PAGER): |
524 | mPagerClient = mClient->currentItem(); | 531 | mPagerClient = mClient->currentItem(); |
525 | break; | 532 | break; |
526 | case(ExternalAppHandler::SIP): | 533 | case(ExternalAppHandler::SIP): |
527 | mSipClient = mClient->currentItem(); | 534 | mSipClient = mClient->currentItem(); |
528 | break; | 535 | break; |
529 | default: | 536 | default: |
530 | return; | 537 | return; |
531 | } | 538 | } |
532 | 539 | ||
533 | //store the current data back to the apropriate membervariables if we had set it to "other" | 540 | //store the current data back to the apropriate membervariables if we had set it to "other" |
534 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 541 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
535 | { | 542 | { |
536 | mEmailOtherChannel = mChannel->text(); | 543 | mEmailOtherChannel = mChannel->text(); |
537 | mEmailOtherMessage = mMessage->text(); | 544 | mEmailOtherMessage = mMessage->text(); |
538 | mEmailOtherMessageParameters = mParameters->text(); | 545 | mEmailOtherMessageParameters = mParameters->text(); |
539 | mEmailOtherMessage2 = mMessage2->text(); | 546 | mEmailOtherMessage2 = mMessage2->text(); |
540 | mEmailOtherMessageParameters2 = mParameters2->text(); | 547 | mEmailOtherMessageParameters2 = mParameters2->text(); |
541 | } | 548 | } |
542 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 549 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
543 | { | 550 | { |
544 | mPhoneOtherChannel = mChannel->text(); | 551 | mPhoneOtherChannel = mChannel->text(); |
545 | mPhoneOtherMessage = mMessage->text(); | 552 | mPhoneOtherMessage = mMessage->text(); |
546 | mPhoneOtherMessageParameters = mParameters->text(); | 553 | mPhoneOtherMessageParameters = mParameters->text(); |
547 | } | 554 | } |
548 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 555 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
549 | { | 556 | { |
550 | mSMSOtherChannel = mChannel->text(); | 557 | mSMSOtherChannel = mChannel->text(); |
551 | mSMSOtherMessage = mMessage->text(); | 558 | mSMSOtherMessage = mMessage->text(); |
552 | mSMSOtherMessageParameters = mParameters->text(); | 559 | mSMSOtherMessageParameters = mParameters->text(); |
553 | } | 560 | } |
554 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 561 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
555 | { | 562 | { |
556 | mFaxOtherChannel = mChannel->text(); | 563 | mFaxOtherChannel = mChannel->text(); |
557 | mFaxOtherMessage = mMessage->text(); | 564 | mFaxOtherMessage = mMessage->text(); |
558 | mFaxOtherMessageParameters = mParameters->text(); | 565 | mFaxOtherMessageParameters = mParameters->text(); |
559 | } | 566 | } |
560 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 567 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
561 | { | 568 | { |
562 | mPagerOtherChannel = mChannel->text(); | 569 | mPagerOtherChannel = mChannel->text(); |
563 | mPagerOtherMessage = mMessage->text(); | 570 | mPagerOtherMessage = mMessage->text(); |
564 | mPagerOtherMessageParameters = mParameters->text(); | 571 | mPagerOtherMessageParameters = mParameters->text(); |
565 | } | 572 | } |
566 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 573 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
567 | { | 574 | { |
568 | mSipOtherChannel = mChannel->text(); | 575 | mSipOtherChannel = mChannel->text(); |
569 | mSipOtherMessage = mMessage->text(); | 576 | mSipOtherMessage = mMessage->text(); |
570 | mSipOtherMessageParameters = mParameters->text(); | 577 | mSipOtherMessageParameters = mParameters->text(); |
571 | } | 578 | } |
572 | 579 | ||
573 | 580 | ||
574 | } | 581 | } |
575 | 582 | ||
576 | void KDEPIMConfigWidget::updateClientWidgets() | 583 | void KDEPIMConfigWidget::updateClientWidgets() |
577 | { | 584 | { |
578 | bool blocked = signalsBlocked(); | 585 | bool blocked = signalsBlocked(); |
579 | blockSignals( true ); | 586 | blockSignals( true ); |
580 | 587 | ||
581 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 588 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
582 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 589 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
583 | if (it == mExternalAppsMap.end()) | 590 | if (it == mExternalAppsMap.end()) |
584 | return; | 591 | return; |
585 | 592 | ||
586 | // update group box | 593 | // update group box |
587 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 594 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
588 | 595 | ||
589 | //update the entries in the client combobox | 596 | //update the entries in the client combobox |
590 | mClient->clear(); | 597 | mClient->clear(); |
591 | 598 | ||
592 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 599 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
593 | DefaultAppItem* dai; | 600 | DefaultAppItem* dai; |
594 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 601 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
595 | { | 602 | { |
596 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 603 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
597 | 604 | ||
598 | if (dai->_id == mCurrentClient) | 605 | if (dai->_id == mCurrentClient) |
599 | { | 606 | { |
600 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 607 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
601 | //Otherwise take the default data from externalapphandler. | 608 | //Otherwise take the default data from externalapphandler. |
602 | mChannel->setText(dai->_channel); | 609 | mChannel->setText(dai->_channel); |
603 | mMessage->setText(dai->_message); | 610 | mMessage->setText(dai->_message); |
604 | mParameters->setText(dai->_parameters); | 611 | mParameters->setText(dai->_parameters); |
605 | mMessage2->setText(dai->_message2); | 612 | mMessage2->setText(dai->_message2); |
606 | mParameters2->setText(dai->_parameters2); | 613 | mParameters2->setText(dai->_parameters2); |
607 | 614 | ||
608 | 615 | ||
609 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 616 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
610 | { | 617 | { |
611 | mChannel->setText(mEmailOtherChannel); | 618 | mChannel->setText(mEmailOtherChannel); |
612 | mMessage->setText(mEmailOtherMessage); | 619 | mMessage->setText(mEmailOtherMessage); |
613 | mParameters->setText(mEmailOtherMessageParameters); | 620 | mParameters->setText(mEmailOtherMessageParameters); |
614 | mMessage2->setText(mEmailOtherMessage2); | 621 | mMessage2->setText(mEmailOtherMessage2); |
615 | mParameters2->setText(mEmailOtherMessageParameters2); | 622 | mParameters2->setText(mEmailOtherMessageParameters2); |
616 | } | 623 | } |
617 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 624 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
618 | { | 625 | { |
619 | mChannel->setText(mPhoneOtherChannel); | 626 | mChannel->setText(mPhoneOtherChannel); |
620 | mMessage->setText(mPhoneOtherMessage); | 627 | mMessage->setText(mPhoneOtherMessage); |
621 | mParameters->setText(mPhoneOtherMessageParameters); | 628 | mParameters->setText(mPhoneOtherMessageParameters); |
622 | } | 629 | } |
623 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 630 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
624 | { | 631 | { |
625 | mChannel->setText(mSMSOtherChannel); | 632 | mChannel->setText(mSMSOtherChannel); |
626 | mMessage->setText(mSMSOtherMessage); | 633 | mMessage->setText(mSMSOtherMessage); |
627 | mParameters->setText(mSMSOtherMessageParameters); | 634 | mParameters->setText(mSMSOtherMessageParameters); |
628 | } | 635 | } |
629 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 636 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
630 | { | 637 | { |
631 | mChannel->setText(mFaxOtherChannel); | 638 | mChannel->setText(mFaxOtherChannel); |
632 | mMessage->setText(mFaxOtherMessage); | 639 | mMessage->setText(mFaxOtherMessage); |
633 | mParameters->setText(mFaxOtherMessageParameters); | 640 | mParameters->setText(mFaxOtherMessageParameters); |
634 | } | 641 | } |
635 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 642 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
636 | { | 643 | { |
637 | mChannel->setText(mPagerOtherChannel); | 644 | mChannel->setText(mPagerOtherChannel); |
638 | mMessage->setText(mPagerOtherMessage); | 645 | mMessage->setText(mPagerOtherMessage); |
639 | mParameters->setText(mPagerOtherMessageParameters); | 646 | mParameters->setText(mPagerOtherMessageParameters); |
640 | } | 647 | } |
641 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 648 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
642 | { | 649 | { |
643 | mChannel->setText(mSipOtherChannel); | 650 | mChannel->setText(mSipOtherChannel); |
644 | mMessage->setText(mSipOtherMessage); | 651 | mMessage->setText(mSipOtherMessage); |
645 | mParameters->setText(mSipOtherMessageParameters); | 652 | mParameters->setText(mSipOtherMessageParameters); |
646 | } | 653 | } |
647 | } | 654 | } |
648 | 655 | ||
649 | } | 656 | } |
650 | 657 | ||
651 | bool readonly; | 658 | bool readonly; |
652 | bool enabled; | 659 | bool enabled; |
653 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 660 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
654 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 661 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
655 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 662 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
656 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 663 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
657 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 664 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
658 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 665 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
659 | { | 666 | { |
660 | readonly = false; | 667 | readonly = false; |
661 | } | 668 | } |